]> git.lizzy.rs Git - rust.git/blob - tests/ui/map_flatten_fixable.stderr
Auto merge of #8596 - Jaic1:unnecessary_cast, r=flip1995
[rust.git] / 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    |                                               ^^^^^^^^^^^^^^^^^^^^^^^^
6    |
7    = note: `-D clippy::map-flatten` implied by `-D warnings`
8 help: try replacing `map` with `filter_map`, and remove the `.flatten()`
9    |
10 LL |     let _: Vec<_> = vec![5_i8; 6].into_iter().filter_map(option_id).collect();
11    |                                               ~~~~~~~~~~~~~~~~~~~~~
12
13 error: called `map(..).flatten()` on `Iterator`
14   --> $DIR/map_flatten_fixable.rs:19:47
15    |
16 LL |     let _: Vec<_> = vec![5_i8; 6].into_iter().map(option_id_ref).flatten().collect();
17    |                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
18    |
19 help: try replacing `map` with `filter_map`, and remove the `.flatten()`
20    |
21 LL |     let _: Vec<_> = vec![5_i8; 6].into_iter().filter_map(option_id_ref).collect();
22    |                                               ~~~~~~~~~~~~~~~~~~~~~~~~~
23
24 error: called `map(..).flatten()` on `Iterator`
25   --> $DIR/map_flatten_fixable.rs:20:47
26    |
27 LL |     let _: Vec<_> = vec![5_i8; 6].into_iter().map(option_id_closure).flatten().collect();
28    |                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
29    |
30 help: try replacing `map` with `filter_map`, and remove the `.flatten()`
31    |
32 LL |     let _: Vec<_> = vec![5_i8; 6].into_iter().filter_map(option_id_closure).collect();
33    |                                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
34
35 error: called `map(..).flatten()` on `Iterator`
36   --> $DIR/map_flatten_fixable.rs:21:47
37    |
38 LL |     let _: Vec<_> = vec![5_i8; 6].into_iter().map(|x| x.checked_add(1)).flatten().collect();
39    |                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
40    |
41 help: try replacing `map` with `filter_map`, and remove the `.flatten()`
42    |
43 LL |     let _: Vec<_> = vec![5_i8; 6].into_iter().filter_map(|x| x.checked_add(1)).collect();
44    |                                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45
46 error: called `map(..).flatten()` on `Iterator`
47   --> $DIR/map_flatten_fixable.rs:24:47
48    |
49 LL |     let _: Vec<_> = vec![5_i8; 6].into_iter().map(|x| 0..x).flatten().collect();
50    |                                               ^^^^^^^^^^^^^^^^^^^^^^^
51    |
52 help: try replacing `map` with `flat_map`, and remove the `.flatten()`
53    |
54 LL |     let _: Vec<_> = vec![5_i8; 6].into_iter().flat_map(|x| 0..x).collect();
55    |                                               ~~~~~~~~~~~~~~~~~~
56
57 error: called `map(..).flatten()` on `Option`
58   --> $DIR/map_flatten_fixable.rs:27:40
59    |
60 LL |     let _: Option<_> = (Some(Some(1))).map(|x| x).flatten();
61    |                                        ^^^^^^^^^^^^^^^^^^^^
62    |
63 help: try replacing `map` with `and_then`, and remove the `.flatten()`
64    |
65 LL |     let _: Option<_> = (Some(Some(1))).and_then(|x| x);
66    |                                        ~~~~~~~~~~~~~~~
67
68 error: called `map(..).flatten()` on `Result`
69   --> $DIR/map_flatten_fixable.rs:30:42
70    |
71 LL |     let _: Result<_, &str> = (Ok(Ok(1))).map(|x| x).flatten();
72    |                                          ^^^^^^^^^^^^^^^^^^^^
73    |
74 help: try replacing `map` with `and_then`, and remove the `.flatten()`
75    |
76 LL |     let _: Result<_, &str> = (Ok(Ok(1))).and_then(|x| x);
77    |                                          ~~~~~~~~~~~~~~~
78
79 error: aborting due to 7 previous errors
80