util: fix type
This commit is contained in:
parent
369780f48f
commit
6a4e753069
1 changed files with 4 additions and 2 deletions
|
@ -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"));
|
||||||
|
|
Loading…
Reference in a new issue