]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/map_flatten_fixable.stderr
Rollup merge of #98617 - ChrisDenton:const-unwrap, r=Mark-Simulacrum
[rust.git] / src / tools / clippy / tests / ui / map_flatten_fixable.stderr
1 error: called `map(..).flatten()` on `Iterator`
2   --> $DIR/map_flatten_fixable.rs:18:47
3    |
4 LL |     let _: Vec<_> = vec![5_i8; 6].into_iter().map(option_id).flatten().collect();
5    |                                               ^^^^^^^^^^^^^^^^^^^^^^^^ help: try replacing `map` with `filter_map` and remove the `.flatten()`: `filter_map(option_id)`
6    |
7    = note: `-D clippy::map-flatten` implied by `-D warnings`
8
9 error: called `map(..).flatten()` on `Iterator`
10   --> $DIR/map_flatten_fixable.rs:19:47
11    |
12 LL |     let _: Vec<_> = vec![5_i8; 6].into_iter().map(option_id_ref).flatten().collect();
13    |                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try replacing `map` with `filter_map` and remove the `.flatten()`: `filter_map(option_id_ref)`
14
15 error: called `map(..).flatten()` on `Iterator`
16   --> $DIR/map_flatten_fixable.rs:20:47
17    |
18 LL |     let _: Vec<_> = vec![5_i8; 6].into_iter().map(option_id_closure).flatten().collect();
19    |                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try replacing `map` with `filter_map` and remove the `.flatten()`: `filter_map(option_id_closure)`
20
21 error: called `map(..).flatten()` on `Iterator`
22   --> $DIR/map_flatten_fixable.rs:21:47
23    |
24 LL |     let _: Vec<_> = vec![5_i8; 6].into_iter().map(|x| x.checked_add(1)).flatten().collect();
25    |                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try replacing `map` with `filter_map` and remove the `.flatten()`: `filter_map(|x| x.checked_add(1))`
26
27 error: called `map(..).flatten()` on `Iterator`
28   --> $DIR/map_flatten_fixable.rs:24:47
29    |
30 LL |     let _: Vec<_> = vec![5_i8; 6].into_iter().map(|x| 0..x).flatten().collect();
31    |                                               ^^^^^^^^^^^^^^^^^^^^^^^ help: try replacing `map` with `flat_map` and remove the `.flatten()`: `flat_map(|x| 0..x)`
32
33 error: called `map(..).flatten()` on `Option`
34   --> $DIR/map_flatten_fixable.rs:27:40
35    |
36 LL |     let _: Option<_> = (Some(Some(1))).map(|x| x).flatten();
37    |                                        ^^^^^^^^^^^^^^^^^^^^ help: try replacing `map` with `and_then` and remove the `.flatten()`: `and_then(|x| x)`
38
39 error: called `map(..).flatten()` on `Result`
40   --> $DIR/map_flatten_fixable.rs:30:42
41    |
42 LL |     let _: Result<_, &str> = (Ok(Ok(1))).map(|x| x).flatten();
43    |                                          ^^^^^^^^^^^^^^^^^^^^ help: try replacing `map` with `and_then` and remove the `.flatten()`: `and_then(|x| x)`
44
45 error: called `map(..).flatten()` on `Option`
46   --> $DIR/map_flatten_fixable.rs:59:10
47    |
48 LL |           .map(|_| {
49    |  __________^
50 LL | | // we need some newlines
51 LL | | // so that the span is big enough
52 LL | | // for a splitted output of the diagnostic
53 ...  |
54 LL | |         })
55 LL | |         .flatten();
56    | |__________________^
57    |
58 help: try replacing `map` with `and_then` and remove the `.flatten()`
59    |
60 LL ~         .and_then(|_| {
61 LL + // we need some newlines
62 LL + // so that the span is big enough
63 LL + // for a splitted output of the diagnostic
64 LL +             Some("")
65 LL +  // whitespace beforehand is important as well
66 LL ~         });
67    |
68
69 error: aborting due to 8 previous errors
70