diff --git a/Cargo.toml b/Cargo.toml index 1ef3937055b0c6a251d78de1222d23848bbe89d8..0d3d59fdb9dce683ab601ee199120f02b245dc6d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -790,6 +790,7 @@ rest_pat_in_fully_bound_structs = "warn" semicolon_outside_block = "warn" str_to_string = "warn" string_lit_chars_any = "warn" +string_slice = "warn" string_to_string = "warn" suspicious_xor_used_as_pow = "warn" tests_outside_test_module = "warn" diff --git a/src/core/config/proxy.rs b/src/core/config/proxy.rs index d823e5e48f574ba10a73dde5c63c250af34a40cd..48f883c6a8a94c3c1e5923aa11b0c9bef1d636bf 100644 --- a/src/core/config/proxy.rs +++ b/src/core/config/proxy.rs @@ -127,6 +127,7 @@ fn more_specific_than(&self, other: &Self) -> bool { impl std::str::FromStr for WildCardedDomain { type Err = std::convert::Infallible; + #[allow(clippy::string_slice)] fn from_str(s: &str) -> Result<Self, Self::Err> { // maybe do some domain validation? Ok(if s.starts_with("*.") { diff --git a/src/core/utils/html.rs b/src/core/utils/html.rs index 938e50ec9232106d6264773f38c615dc4dcf2592..fe07b2dd768ab37d913a90e955af223c6b4fe32c 100644 --- a/src/core/utils/html.rs +++ b/src/core/utils/html.rs @@ -6,6 +6,7 @@ /// Copied from librustdoc: /// * <https://github.com/rust-lang/rust/blob/cbaeec14f90b59a91a6b0f17fc046c66fa811892/src/librustdoc/html/escape.rs> +#[allow(clippy::string_slice)] impl fmt::Display for Escape<'_> { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { // Because the internet is always right, turns out there's not that many diff --git a/src/core/utils/string.rs b/src/core/utils/string.rs index 1f2a65727f5b320a88a287b6177f675ba09f310a..ec423d53b3027f80451b95d92f7dcb586a220f4b 100644 --- a/src/core/utils/string.rs +++ b/src/core/utils/string.rs @@ -9,12 +9,13 @@ /// common_prefix(&input) == "con"; /// ``` #[must_use] +#[allow(clippy::string_slice)] pub fn common_prefix<'a>(choice: &'a [&str]) -> &'a str { choice.first().map_or(EMPTY, move |best| { choice.iter().skip(1).fold(*best, |best, choice| { &best[0..choice - .chars() - .zip(best.chars()) + .char_indices() + .zip(best.char_indices()) .take_while(|&(a, b)| a == b) .count()] }) diff --git a/src/service/sending/resolve.rs b/src/service/sending/resolve.rs index 773110060ae1f5045d15d0878d4569c3248f6e38..d38509ba8d0cdbafa1af8a10db2fe4229a5373f4 100644 --- a/src/service/sending/resolve.rs +++ b/src/service/sending/resolve.rs @@ -484,6 +484,7 @@ fn hostname(&self) -> String { } #[inline] + #[allow(clippy::string_slice)] fn port(&self) -> Option<u16> { match &self { Self::Literal(addr) => Some(addr.port()),