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