util: fix type

This commit is contained in:
anna 2022-12-22 18:57:01 +01:00
parent 369780f48f
commit 6a4e753069
Signed by: fef
GPG key ID: EC22E476DC2D3D84

View file

@ -137,7 +137,9 @@ impl<'de> de::Visitor<'de> for BearcapVisitor {
impl Validate for Bearcap { impl Validate for Bearcap {
fn validate(&self, builder: ResultBuilder) -> ResultBuilder { fn validate(&self, builder: ResultBuilder) -> ResultBuilder {
builder.field(&self.url, "url", |f| { builder.field(&self.url, "url", |f| {
f.check("URL must start with https://", |v| v.starts_with("https://")) f.check("URL must start with https://", |v| {
v.starts_with("https://")
})
}) })
} }
} }
@ -148,7 +150,7 @@ mod tests {
use serde_test::{assert_tokens, Token}; use serde_test::{assert_tokens, Token};
#[test] #[test]
fn parse_vali() { fn parse_valid() {
let bc = Bearcap::try_from("bear:?t=asdf&u=https://example.com/test") let bc = Bearcap::try_from("bear:?t=asdf&u=https://example.com/test")
.expect("Doesn't parse valid bearcap"); .expect("Doesn't parse valid bearcap");
assert_eq!(bc.url, String::from("https://example.com/test")); assert_eq!(bc.url, String::from("https://example.com/test"));