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:
Charles Hall 2024-05-12 19:08:12 -07:00
parent 9abe4799db
commit 844b32f097
No known key found for this signature in database
GPG key ID: 7B8E0645816E07CF
7 changed files with 35 additions and 73 deletions

View file

@ -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 {