mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-18 08:11:24 +01:00
enable string_slice lint
Also swaps out vendored HTML-escaping code for a dependency that I imagine has decent testing considering all of its reverse depedencies.
This commit is contained in:
parent
9abe4799db
commit
844b32f097
7 changed files with 35 additions and 73 deletions
|
|
@ -124,13 +124,10 @@ impl std::str::FromStr for WildCardedDomain {
|
|||
type Err = std::convert::Infallible;
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
// maybe do some domain validation?
|
||||
Ok(if s.starts_with("*.") {
|
||||
WildCardedDomain::WildCarded(s[1..].to_owned())
|
||||
} else if s == "*" {
|
||||
WildCardedDomain::WildCarded("".to_owned())
|
||||
} else {
|
||||
WildCardedDomain::Exact(s.to_owned())
|
||||
})
|
||||
Ok(s.strip_prefix("*.")
|
||||
.map(|x| WildCardedDomain::WildCarded(x.to_owned()))
|
||||
.or_else(|| (s == "*").then(|| WildCardedDomain::WildCarded(String::new())))
|
||||
.unwrap_or_else(|| WildCardedDomain::Exact(s.to_owned())))
|
||||
}
|
||||
}
|
||||
impl<'de> Deserialize<'de> for WildCardedDomain {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue