Skip to content

Commit fbda150

Browse files
committed
1 parent 57c190d commit fbda150

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

crates/core/search.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -389,15 +389,15 @@ fn search_path<M: Matcher, W: WriteColor>(
389389
searcher.search_path(&matcher, path, &mut sink)?;
390390
Ok(SearchResult {
391391
has_match: sink.has_match(),
392-
stats: sink.stats().map(|s| s.clone()),
392+
stats: sink.stats().cloned(),
393393
})
394394
}
395395
Printer::Summary(ref mut p) => {
396396
let mut sink = p.sink_with_path(&matcher, path);
397397
searcher.search_path(&matcher, path, &mut sink)?;
398398
Ok(SearchResult {
399399
has_match: sink.has_match(),
400-
stats: sink.stats().map(|s| s.clone()),
400+
stats: sink.stats().cloned(),
401401
})
402402
}
403403
Printer::JSON(ref mut p) => {
@@ -426,15 +426,15 @@ fn search_reader<M: Matcher, R: io::Read, W: WriteColor>(
426426
searcher.search_reader(&matcher, &mut rdr, &mut sink)?;
427427
Ok(SearchResult {
428428
has_match: sink.has_match(),
429-
stats: sink.stats().map(|s| s.clone()),
429+
stats: sink.stats().cloned(),
430430
})
431431
}
432432
Printer::Summary(ref mut p) => {
433433
let mut sink = p.sink_with_path(&matcher, path);
434434
searcher.search_reader(&matcher, &mut rdr, &mut sink)?;
435435
Ok(SearchResult {
436436
has_match: sink.has_match(),
437-
stats: sink.stats().map(|s| s.clone()),
437+
stats: sink.stats().cloned(),
438438
})
439439
}
440440
Printer::JSON(ref mut p) => {

crates/globset/src/glob.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1058,7 +1058,7 @@ impl<'a> Parser<'a> {
10581058
}
10591059

10601060
fn peek(&mut self) -> Option<char> {
1061-
self.chars.peek().map(|&ch| ch)
1061+
self.chars.peek().copied()
10621062
}
10631063
}
10641064

crates/matcher/tests/util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ impl Matcher for RegexMatcher {
5454
}
5555

5656
fn capture_index(&self, name: &str) -> Option<usize> {
57-
self.names.get(name).map(|i| *i)
57+
self.names.get(name).copied()
5858
}
5959

6060
// We purposely don't implement any other methods, so that we test the

crates/pcre2/src/matcher.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ impl Matcher for RegexMatcher {
337337
}
338338

339339
fn capture_index(&self, name: &str) -> Option<usize> {
340-
self.names.get(name).map(|i| *i)
340+
self.names.get(name).copied()
341341
}
342342

343343
fn try_find_iter<F, E>(

0 commit comments

Comments
 (0)