1 error: called `map(..).flatten()` on `Iterator`
2 --> $DIR/map_flatten_fixable.rs:18:47
4 LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(option_id).flatten().collect();
5 | ^^^^^^^^^^^^^^^^^^^^^^^^
7 = note: `-D clippy::map-flatten` implied by `-D warnings`
8 help: try replacing `map` with `filter_map`, and remove the `.flatten()`
10 LL | let _: Vec<_> = vec![5_i8; 6].into_iter().filter_map(option_id).collect();
11 | ~~~~~~~~~~~~~~~~~~~~~
13 error: called `map(..).flatten()` on `Iterator`
14 --> $DIR/map_flatten_fixable.rs:19:47
16 LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(option_id_ref).flatten().collect();
17 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
19 help: try replacing `map` with `filter_map`, and remove the `.flatten()`
21 LL | let _: Vec<_> = vec![5_i8; 6].into_iter().filter_map(option_id_ref).collect();
22 | ~~~~~~~~~~~~~~~~~~~~~~~~~
24 error: called `map(..).flatten()` on `Iterator`
25 --> $DIR/map_flatten_fixable.rs:20:47
27 LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(option_id_closure).flatten().collect();
28 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
30 help: try replacing `map` with `filter_map`, and remove the `.flatten()`
32 LL | let _: Vec<_> = vec![5_i8; 6].into_iter().filter_map(option_id_closure).collect();
33 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
35 error: called `map(..).flatten()` on `Iterator`
36 --> $DIR/map_flatten_fixable.rs:21:47
38 LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(|x| x.checked_add(1)).flatten().collect();
39 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
41 help: try replacing `map` with `filter_map`, and remove the `.flatten()`
43 LL | let _: Vec<_> = vec![5_i8; 6].into_iter().filter_map(|x| x.checked_add(1)).collect();
44 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
46 error: called `map(..).flatten()` on `Iterator`
47 --> $DIR/map_flatten_fixable.rs:24:47
49 LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(|x| 0..x).flatten().collect();
50 | ^^^^^^^^^^^^^^^^^^^^^^^
52 help: try replacing `map` with `flat_map`, and remove the `.flatten()`
54 LL | let _: Vec<_> = vec![5_i8; 6].into_iter().flat_map(|x| 0..x).collect();
57 error: called `map(..).flatten()` on `Option`
58 --> $DIR/map_flatten_fixable.rs:27:40
60 LL | let _: Option<_> = (Some(Some(1))).map(|x| x).flatten();
61 | ^^^^^^^^^^^^^^^^^^^^
63 help: try replacing `map` with `and_then`, and remove the `.flatten()`
65 LL | let _: Option<_> = (Some(Some(1))).and_then(|x| x);
68 error: called `map(..).flatten()` on `Result`
69 --> $DIR/map_flatten_fixable.rs:30:42
71 LL | let _: Result<_, &str> = (Ok(Ok(1))).map(|x| x).flatten();
72 | ^^^^^^^^^^^^^^^^^^^^
74 help: try replacing `map` with `and_then`, and remove the `.flatten()`
76 LL | let _: Result<_, &str> = (Ok(Ok(1))).and_then(|x| x);
79 error: aborting due to 7 previous errors