]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/map_flatten.stderr
Add a fixme comment
[rust.git] / src / tools / clippy / tests / ui / map_flatten.stderr
1 error: called `map(..).flatten()` on `Option`
2   --> $DIR/map_flatten.rs:8:10
3    |
4 LL |           .map(|x| {
5    |  __________^
6 LL | |             if x <= 5 {
7 LL | |                 Some(x)
8 LL | |             } else {
9 ...  |
10 LL | |         })
11 LL | |         .flatten();
12    | |__________________^
13    |
14    = note: `-D clippy::map-flatten` implied by `-D warnings`
15 help: try replacing `map` with `and_then`
16    |
17 LL ~         .and_then(|x| {
18 LL +             if x <= 5 {
19 LL +                 Some(x)
20    |
21 help: and remove the `.flatten()`
22    |
23 LL +                 None
24 LL +             }
25 LL ~         });
26    |
27
28 error: called `map(..).flatten()` on `Result`
29   --> $DIR/map_flatten.rs:18:10
30    |
31 LL |           .map(|x| {
32    |  __________^
33 LL | |             if x == 1 {
34 LL | |                 Ok(x)
35 LL | |             } else {
36 ...  |
37 LL | |         })
38 LL | |         .flatten();
39    | |__________________^
40    |
41 help: try replacing `map` with `and_then`
42    |
43 LL ~         .and_then(|x| {
44 LL +             if x == 1 {
45 LL +                 Ok(x)
46    |
47 help: and remove the `.flatten()`
48    |
49 LL +                 Err(0)
50 LL +             }
51 LL ~         });
52    |
53
54 error: called `map(..).flatten()` on `Result`
55   --> $DIR/map_flatten.rs:30:10
56    |
57 LL |           .map(|res| {
58    |  __________^
59 LL | |             if res > 0 {
60 LL | |                 do_something();
61 LL | |                 Ok(res)
62 ...  |
63 LL | |         })
64 LL | |         .flatten();
65    | |__________________^
66    |
67 help: try replacing `map` with `and_then`
68    |
69 LL ~         .and_then(|res| {
70 LL +             if res > 0 {
71 LL +                 do_something();
72    |
73 help: and remove the `.flatten()`
74    |
75 LL +                 Err(0)
76 LL +             }
77 LL ~         });
78    |
79
80 error: called `map(..).flatten()` on `Iterator`
81   --> $DIR/map_flatten.rs:42:10
82    |
83 LL |           .map(|some_value| {
84    |  __________^
85 LL | |             if some_value > 3 {
86 LL | |                 Some(some_value)
87 LL | |             } else {
88 ...  |
89 LL | |         })
90 LL | |         .flatten()
91    | |__________________^
92    |
93 help: try replacing `map` with `filter_map`
94    |
95 LL ~         .filter_map(|some_value| {
96 LL +             if some_value > 3 {
97 LL +                 Some(some_value)
98    |
99 help: and remove the `.flatten()`
100    |
101 LL +                 None
102 LL +             }
103 LL +         })
104    |
105
106 error: aborting due to 4 previous errors
107