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
33 |
44LL | let _ = (0..4).filter_map(|x| if x > 1 { Some(x) } else { None });
5- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try instead: `filter`
5+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66 |
77 = note: `-D clippy::unnecessary-filter-map` implied by `-D warnings`
88 = help: to override `-D warnings` add `#[allow(clippy::unnecessary_filter_map)]`
99
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
1212 |
1313LL | let _ = (0..4).filter_map(|x| {
1414 | _____________^
@@ -18,51 +18,36 @@ LL | | if x > 1 {
1818... |
1919LL | | None
2020LL | | });
21- | |______^ help: try instead: `filter`
21+ | |______^
2222
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
2525 |
2626LL | let _ = (0..4).filter_map(|x| match x {
2727 | _____________^
2828LL | |
2929LL | | 0 | 1 => None,
3030LL | | _ => Some(x),
3131LL | | });
32- | |______^ help: try instead: `filter`
32+ | |______^
3333
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
3636 |
3737LL | let _ = (0..4).filter_map(|x| Some(x + 1));
38- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try instead: `map`
38+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3939
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
4242 |
4343LL | 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+ | ^^^^
6045
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
6348 |
6449LL | let _x = std::iter::once(1).filter_map(|n| (n > 1).then_some(n));
65- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try instead: `filter`
50+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6651
67- error: aborting due to 8 previous errors
52+ error: aborting due to 6 previous errors
6853
0 commit comments