summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/unnecessary_filter_map.stderr
blob: 2d5403ce3944441638513a3b82f0336141cf3691 (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
error: this `.filter_map` can be written more simply using `.filter`
  --> $DIR/unnecessary_filter_map.rs:4:13
   |
LL |     let _ = (0..4).filter_map(|x| if x > 1 { Some(x) } else { None });
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `-D clippy::unnecessary-filter-map` implied by `-D warnings`

error: this `.filter_map` can be written more simply using `.filter`
  --> $DIR/unnecessary_filter_map.rs:5:13
   |
LL |       let _ = (0..4).filter_map(|x| {
   |  _____________^
LL | |         if x > 1 {
LL | |             return Some(x);
LL | |         };
LL | |         None
LL | |     });
   | |______^

error: this `.filter_map` can be written more simply using `.filter`
  --> $DIR/unnecessary_filter_map.rs:11:13
   |
LL |       let _ = (0..4).filter_map(|x| match x {
   |  _____________^
LL | |         0 | 1 => None,
LL | |         _ => Some(x),
LL | |     });
   | |______^

error: this `.filter_map` can be written more simply using `.map`
  --> $DIR/unnecessary_filter_map.rs:16:13
   |
LL |     let _ = (0..4).filter_map(|x| Some(x + 1));
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: this `.filter_map` can be written more simply using `.filter`
  --> $DIR/unnecessary_filter_map.rs:155:14
   |
LL |     let _x = std::iter::once(1).filter_map(|n| (n > 1).then_some(n));
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 5 previous errors