2022-03-14 11:02:53 +00:00
|
|
|
error: this `.find_map` can be written more simply using `.find`
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/unnecessary_find_map.rs:4:13
|
2022-03-14 11:02:53 +00:00
|
|
|
|
|
|
|
|
LL | let _ = (0..4).find_map(|x| if x > 1 { Some(x) } else { None });
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= note: `-D clippy::unnecessary-find-map` implied by `-D warnings`
|
2023-08-01 12:02:21 +00:00
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::unnecessary_find_map)]`
|
2022-03-14 11:02:53 +00:00
|
|
|
|
|
|
|
error: this `.find_map` can be written more simply using `.find`
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/unnecessary_find_map.rs:7:13
|
2022-03-14 11:02:53 +00:00
|
|
|
|
|
|
|
|
LL | let _ = (0..4).find_map(|x| {
|
|
|
|
| _____________^
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
2022-03-14 11:02:53 +00:00
|
|
|
LL | | if x > 1 {
|
|
|
|
LL | | return Some(x);
|
|
|
|
LL | | };
|
|
|
|
LL | | None
|
|
|
|
LL | | });
|
|
|
|
| |______^
|
|
|
|
|
|
|
|
error: this `.find_map` can be written more simply using `.find`
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/unnecessary_find_map.rs:14:13
|
2022-03-14 11:02:53 +00:00
|
|
|
|
|
|
|
|
LL | let _ = (0..4).find_map(|x| match x {
|
|
|
|
| _____________^
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
2022-03-14 11:02:53 +00:00
|
|
|
LL | | 0 | 1 => None,
|
|
|
|
LL | | _ => Some(x),
|
|
|
|
LL | | });
|
|
|
|
| |______^
|
|
|
|
|
|
|
|
error: this `.find_map` can be written more simply using `.map(..).next()`
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/unnecessary_find_map.rs:20:13
|
2022-03-14 11:02:53 +00:00
|
|
|
|
|
|
|
|
LL | let _ = (0..4).find_map(|x| Some(x + 1));
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2023-07-31 21:53:53 +00:00
|
|
|
error: this `.find_map` can be written more simply using `.find`
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/unnecessary_find_map.rs:32:14
|
2023-07-31 21:53:53 +00:00
|
|
|
|
|
|
|
|
LL | let _x = std::iter::once(1).find_map(|n| (n > 1).then_some(n));
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
error: aborting due to 5 previous errors
|
2022-03-14 11:02:53 +00:00
|
|
|
|