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