fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
1.5 KiB47 linesraw
1error: this `.find_map` can be written more simply using `.find`
2  --> $DIR/unnecessary_find_map.rs:4:13
3   |
4LL |     let _ = (0..4).find_map(|x| if x > 1 { Some(x) } else { None });
5   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6   |
7   = note: `-D clippy::unnecessary-find-map` implied by `-D warnings`
8   = help: to override `-D warnings` add `#[allow(clippy::unnecessary_find_map)]`
9
10error: this `.find_map` can be written more simply using `.find`
11  --> $DIR/unnecessary_find_map.rs:7:13
12   |
13LL |       let _ = (0..4).find_map(|x| {
14   |  _____________^
15LL | |
16LL | |         if x > 1 {
17LL | |             return Some(x);
18LL | |         };
19LL | |         None
20LL | |     });
21   | |______^
22
23error: this `.find_map` can be written more simply using `.find`
24  --> $DIR/unnecessary_find_map.rs:14:13
25   |
26LL |       let _ = (0..4).find_map(|x| match x {
27   |  _____________^
28LL | |
29LL | |         0 | 1 => None,
30LL | |         _ => Some(x),
31LL | |     });
32   | |______^
33
34error: this `.find_map` can be written more simply using `.map(..).next()`
35  --> $DIR/unnecessary_find_map.rs:20:13
36   |
37LL |     let _ = (0..4).find_map(|x| Some(x + 1));
38   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
39
40error: this `.find_map` can be written more simply using `.find`
41  --> $DIR/unnecessary_find_map.rs:32:14
42   |
43LL |     let _x = std::iter::once(1).find_map(|n| (n > 1).then_some(n));
44   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
45
46error: aborting due to 5 previous errors
47