1
- error: this `.filter_map` can be written more simply
2
- --> tests/ui/unnecessary_filter_map.rs:5 :13
1
+ error: this `.filter_map(..) ` can be written more simply using `.filter(..)`
2
+ --> tests/ui/unnecessary_filter_map.rs:4 :13
3
3
|
4
4
LL | let _ = (0..4).filter_map(|x| if x > 1 { Some(x) } else { None });
5
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try instead: `filter`
5
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6
6
|
7
7
= note: `-D clippy::unnecessary-filter-map` implied by `-D warnings`
8
8
= help: to override `-D warnings` add `#[allow(clippy::unnecessary_filter_map)]`
9
9
10
- error: this `.filter_map` can be written more simply
11
- --> tests/ui/unnecessary_filter_map.rs:8 :13
10
+ error: this `.filter_map(..) ` can be written more simply using `.filter(..)`
11
+ --> tests/ui/unnecessary_filter_map.rs:7 :13
12
12
|
13
13
LL | let _ = (0..4).filter_map(|x| {
14
14
| _____________^
@@ -18,51 +18,36 @@ LL | | if x > 1 {
18
18
... |
19
19
LL | | None
20
20
LL | | });
21
- | |______^ help: try instead: `filter`
21
+ | |______^
22
22
23
- error: this `.filter_map` can be written more simply
24
- --> tests/ui/unnecessary_filter_map.rs:16 :13
23
+ error: this `.filter_map(..) ` can be written more simply using `.filter(..)`
24
+ --> tests/ui/unnecessary_filter_map.rs:15 :13
25
25
|
26
26
LL | let _ = (0..4).filter_map(|x| match x {
27
27
| _____________^
28
28
LL | |
29
29
LL | | 0 | 1 => None,
30
30
LL | | _ => Some(x),
31
31
LL | | });
32
- | |______^ help: try instead: `filter`
32
+ | |______^
33
33
34
- error: this `.filter_map` can be written more simply
35
- --> tests/ui/unnecessary_filter_map.rs:22 :13
34
+ error: this `.filter_map(..) ` can be written more simply using `.map(..)`
35
+ --> tests/ui/unnecessary_filter_map.rs:21 :13
36
36
|
37
37
LL | let _ = (0..4).filter_map(|x| Some(x + 1));
38
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try instead: `map`
38
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
39
39
40
- error: redundant closure
41
- --> tests/ui/unnecessary_filter_map.rs:29:57
40
+ error: this call to `.filter_map(..)` is unnecessary
41
+ --> tests/ui/unnecessary_filter_map.rs:28:61
42
42
|
43
43
LL | let _ = vec![Some(10), None].into_iter().filter_map(|x| Some(x));
44
- | ^^^^^^^^^^^ help: replace the closure with the function itself: `Some`
45
- |
46
- = note: `-D clippy::redundant-closure` implied by `-D warnings`
47
- = help: to override `-D warnings` add `#[allow(clippy::redundant_closure)]`
48
-
49
- error: filter_map is unnecessary
50
- --> tests/ui/unnecessary_filter_map.rs:29:61
51
- |
52
- LL | let _ = vec![Some(10), None].into_iter().filter_map(|x| Some(x));
53
- | ^^^^ help: try removing the filter_map
54
-
55
- error: this `.filter_map` can be written more simply
56
- --> tests/ui/unnecessary_filter_map.rs:29:13
57
- |
58
- LL | let _ = vec![Some(10), None].into_iter().filter_map(|x| Some(x));
59
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try instead: `map`
44
+ | ^^^^
60
45
61
- error: this `.filter_map` can be written more simply
62
- --> tests/ui/unnecessary_filter_map.rs:169 :14
46
+ error: this `.filter_map(..) ` can be written more simply using `.filter(..)`
47
+ --> tests/ui/unnecessary_filter_map.rs:166 :14
63
48
|
64
49
LL | let _x = std::iter::once(1).filter_map(|n| (n > 1).then_some(n));
65
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try instead: `filter`
50
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
51
67
- error: aborting due to 8 previous errors
52
+ error: aborting due to 6 previous errors
68
53
0 commit comments