260709.13 · e7b0f89e81811b295446404f02ca133fe8434054
lint: use `cloned()` or `copied()` when we can
Ref https://rust-lang.github.io/rust-clippy/master/index.html#map_clone
Closes #3230
reading declarations
@@ -389,7 +389,7 @@ fn search_path<M: Matcher, W: WriteColor>( searcher.search_path(&matcher, path, &mut sink)?; Ok(SearchResult { has_match: sink.has_match(),- stats: sink.stats().map(|s| s.clone()),+ stats: sink.stats().cloned(), }) } Printer::Summary(ref mut p) => {@@ -397,7 +397,7 @@ fn search_path<M: Matcher, W: WriteColor>( searcher.search_path(&matcher, path, &mut sink)?; Ok(SearchResult { has_match: sink.has_match(),- stats: sink.stats().map(|s| s.clone()),+ stats: sink.stats().cloned(), }) } Printer::JSON(ref mut p) => {@@ -426,7 +426,7 @@ fn search_reader<M: Matcher, R: io::Read, W: WriteColor>( searcher.search_reader(&matcher, &mut rdr, &mut sink)?; Ok(SearchResult { has_match: sink.has_match(),- stats: sink.stats().map(|s| s.clone()),+ stats: sink.stats().cloned(), }) } Printer::Summary(ref mut p) => {@@ -434,7 +434,7 @@ fn search_reader<M: Matcher, R: io::Read, W: WriteColor>( searcher.search_reader(&matcher, &mut rdr, &mut sink)?; Ok(SearchResult { has_match: sink.has_match(),- stats: sink.stats().map(|s| s.clone()),+ stats: sink.stats().cloned(), }) } Printer::JSON(ref mut p) => {
@@ -1058,7 +1058,7 @@ impl<'a> Parser<'a> { } fn peek(&mut self) -> Option<char> {- self.chars.peek().map(|&ch| ch)+ self.chars.peek().copied() } }
@@ -54,7 +54,7 @@ impl Matcher for RegexMatcher { } fn capture_index(&self, name: &str) -> Option<usize> {- self.names.get(name).map(|i| *i)+ self.names.get(name).copied() } // We purposely don't implement any other methods, so that we test the
@@ -337,7 +337,7 @@ impl Matcher for RegexMatcher { } fn capture_index(&self, name: &str) -> Option<usize> {- self.names.get(name).map(|i| *i)+ self.names.get(name).copied() } fn try_find_iter<F, E>(