From 645eabc8d94aa75764bcdcde69a6faebe7be57f6 Mon Sep 17 00:00:00 2001 From: Omid Rad Date: Wed, 1 Sep 2021 20:19:39 +0200 Subject: [PATCH] Clippy --- actix-router/src/path.rs | 6 +++--- actix-router/src/resource.rs | 6 +++--- actix-tls/src/connect/connect.rs | 2 +- actix-tls/src/connect/resolve.rs | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/actix-router/src/path.rs b/actix-router/src/path.rs index e29591f9..9af7b0b8 100644 --- a/actix-router/src/path.rs +++ b/actix-router/src/path.rs @@ -125,7 +125,7 @@ impl Path { for (seg_name, val) in self.segments.iter() { if name == seg_name { return match val { - PathItem::Static(ref s) => Some(&s), + PathItem::Static(ref s) => Some(s), PathItem::Segment(s, e) => { Some(&self.path.path()[(*s as usize)..(*e as usize)]) } @@ -183,7 +183,7 @@ impl<'a, T: ResourcePath> Iterator for PathIter<'a, T> { if self.idx < self.params.segment_count() { let idx = self.idx; let res = match self.params.segments[idx].1 { - PathItem::Static(ref s) => &s, + PathItem::Static(ref s) => s, PathItem::Segment(s, e) => &self.params.path.path()[(s as usize)..(e as usize)], }; self.idx += 1; @@ -207,7 +207,7 @@ impl Index for Path { fn index(&self, idx: usize) -> &str { match self.segments[idx].1 { - PathItem::Static(ref s) => &s, + PathItem::Static(ref s) => s, PathItem::Segment(s, e) => &self.path.path()[(s as usize)..(e as usize)], } } diff --git a/actix-router/src/resource.rs b/actix-router/src/resource.rs index 61ff587a..69e10b2b 100644 --- a/actix-router/src/resource.rs +++ b/actix-router/src/resource.rs @@ -276,7 +276,7 @@ impl ResourceDef { let mut pattern_data = Vec::new(); for pattern in &patterns { - match ResourceDef::parse(&pattern, false, true) { + match ResourceDef::parse(pattern, false, true) { (PatternType::Dynamic(re, names), _) => { re_set.push(re.as_str().to_owned()); pattern_data.push((re, names)); @@ -790,7 +790,7 @@ impl ResourceDef { profile_section!(pattern_dynamic_extract_captures); for (no, name) in names.iter().enumerate() { - if let Some(m) = captures.name(&name) { + if let Some(m) = captures.name(name) { segments[no] = PathItem::Segment(m.start() as u16, m.end() as u16); } else { log::error!( @@ -820,7 +820,7 @@ impl ResourceDef { }; for (no, name) in names.iter().enumerate() { - if let Some(m) = captures.name(&name) { + if let Some(m) = captures.name(name) { segments[no] = PathItem::Segment(m.start() as u16, m.end() as u16); } else { log::error!("Dynamic path match but not all segments found: {}", name); diff --git a/actix-tls/src/connect/connect.rs b/actix-tls/src/connect/connect.rs index bd4b3fdf..730486cf 100755 --- a/actix-tls/src/connect/connect.rs +++ b/actix-tls/src/connect/connect.rs @@ -19,7 +19,7 @@ pub trait Address: Unpin + 'static { impl Address for String { fn hostname(&self) -> &str { - &self + self } } diff --git a/actix-tls/src/connect/resolve.rs b/actix-tls/src/connect/resolve.rs index 0a92b9b1..335e69d8 100755 --- a/actix-tls/src/connect/resolve.rs +++ b/actix-tls/src/connect/resolve.rs @@ -164,7 +164,7 @@ impl Service> for Resolver { } Self::Custom(resolver) => { - let resolver = Rc::clone(&resolver); + let resolver = Rc::clone(resolver); ResolverFuture::LookupCustom(Box::pin(async move { let addrs = resolver .lookup(req.hostname(), req.port())