diff options
Diffstat (limited to 'src/tools/clippy/tests/ui/unnecessary_find_map.rs')
-rw-r--r-- | src/tools/clippy/tests/ui/unnecessary_find_map.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui/unnecessary_find_map.rs b/src/tools/clippy/tests/ui/unnecessary_find_map.rs index 2c228fbbc..9972b6809 100644 --- a/src/tools/clippy/tests/ui/unnecessary_find_map.rs +++ b/src/tools/clippy/tests/ui/unnecessary_find_map.rs @@ -2,18 +2,23 @@ fn main() { let _ = (0..4).find_map(|x| if x > 1 { Some(x) } else { None }); + //~^ ERROR: this `.find_map` can be written more simply using `.find` + //~| NOTE: `-D clippy::unnecessary-find-map` implied by `-D warnings` let _ = (0..4).find_map(|x| { + //~^ ERROR: this `.find_map` can be written more simply using `.find` if x > 1 { return Some(x); }; None }); let _ = (0..4).find_map(|x| match x { + //~^ ERROR: this `.find_map` can be written more simply using `.find` 0 | 1 => None, _ => Some(x), }); let _ = (0..4).find_map(|x| Some(x + 1)); + //~^ ERROR: this `.find_map` can be written more simply using `.map(..).next()` let _ = (0..4).find_map(i32::checked_abs); } |