From 2cbc42730b383bcef3ffd92c6a3c3c4233d7475b Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Tue, 16 Jul 2024 21:14:53 +0200 Subject: [PATCH] Fix clippy warnings --- ntex-router/src/de.rs | 5 ----- ntex-router/src/resource.rs | 5 +++-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/ntex-router/src/de.rs b/ntex-router/src/de.rs index 38aae0a5..4a3fbb29 100644 --- a/ntex-router/src/de.rs +++ b/ntex-router/src/de.rs @@ -502,11 +502,6 @@ mod tests { value: String, } - #[derive(Deserialize)] - struct Id { - _id: String, - } - #[derive(Debug, Deserialize)] struct Test1(String, u32); diff --git a/ntex-router/src/resource.rs b/ntex-router/src/resource.rs index 4b57f500..ba81b168 100644 --- a/ntex-router/src/resource.rs +++ b/ntex-router/src/resource.rs @@ -306,7 +306,7 @@ impl ResourceDef { elems.push(PathElement::Var(name.to_string())); - if let Some(idx) = rem.find(|c| c == '{' || c == '/') { + if let Some(idx) = rem.find(['{', '/']) { end = Some(idx); pattern = rem; continue; @@ -346,7 +346,7 @@ impl ResourceDef { loop { let start = usize::from(pattern.starts_with('/')); - let idx = if let Some(idx) = pattern[start..].find(|c| c == '{' || c == '/') { + let idx = if let Some(idx) = pattern[start..].find(['{', '/']) { idx + start } else { break; @@ -710,6 +710,7 @@ mod tests { } #[test] + #[allow(clippy::mutable_key_type)] fn test_def() { let re = ResourceDef::new("/user/-{id}*"); assert_eq!(re, ResourceDef::from("/user/-{id}*"));