mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-16 02:24:35 +00:00
39 lines
1.1 KiB
Plaintext
39 lines
1.1 KiB
Plaintext
error: this `.find_map` can be written more simply using `.find`
|
|
--> $DIR/unnecessary_find_map.rs:4:13
|
|
|
|
|
LL | let _ = (0..4).find_map(|x| if x > 1 { Some(x) } else { None });
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: `-D clippy::unnecessary-find-map` implied by `-D warnings`
|
|
|
|
error: this `.find_map` can be written more simply using `.find`
|
|
--> $DIR/unnecessary_find_map.rs:5:13
|
|
|
|
|
LL | let _ = (0..4).find_map(|x| {
|
|
| _____________^
|
|
LL | | if x > 1 {
|
|
LL | | return Some(x);
|
|
LL | | };
|
|
LL | | None
|
|
LL | | });
|
|
| |______^
|
|
|
|
error: this `.find_map` can be written more simply using `.find`
|
|
--> $DIR/unnecessary_find_map.rs:11:13
|
|
|
|
|
LL | let _ = (0..4).find_map(|x| match x {
|
|
| _____________^
|
|
LL | | 0 | 1 => None,
|
|
LL | | _ => Some(x),
|
|
LL | | });
|
|
| |______^
|
|
|
|
error: this `.find_map` can be written more simply using `.map(..).next()`
|
|
--> $DIR/unnecessary_find_map.rs:16:13
|
|
|
|
|
LL | let _ = (0..4).find_map(|x| Some(x + 1));
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: aborting due to 4 previous errors
|
|
|