|
1 | 1 | error: called `map(..).flatten()` on an `Iterator` |
2 | | - --> $DIR/map_flatten.rs:16:46 |
| 2 | + --> $DIR/map_flatten.rs:17:46 |
3 | 3 | | |
4 | 4 | LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(option_id).flatten().collect(); |
5 | 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using `filter_map` instead: `.filter_map(option_id)` |
6 | 6 | | |
7 | 7 | = note: `-D clippy::map-flatten` implied by `-D warnings` |
8 | 8 |
|
9 | 9 | error: called `map(..).flatten()` on an `Iterator` |
10 | | - --> $DIR/map_flatten.rs:17:46 |
| 10 | + --> $DIR/map_flatten.rs:18:46 |
11 | 11 | | |
12 | 12 | LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(option_id_ref).flatten().collect(); |
13 | 13 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using `filter_map` instead: `.filter_map(option_id_ref)` |
14 | 14 |
|
15 | 15 | error: called `map(..).flatten()` on an `Iterator` |
16 | | - --> $DIR/map_flatten.rs:18:46 |
| 16 | + --> $DIR/map_flatten.rs:19:46 |
17 | 17 | | |
18 | 18 | LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(option_id_closure).flatten().collect(); |
19 | 19 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using `filter_map` instead: `.filter_map(option_id_closure)` |
20 | 20 |
|
21 | 21 | error: called `map(..).flatten()` on an `Iterator` |
22 | | - --> $DIR/map_flatten.rs:19:46 |
| 22 | + --> $DIR/map_flatten.rs:20:46 |
23 | 23 | | |
24 | 24 | LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(|x| x.checked_add(1)).flatten().collect(); |
25 | 25 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using `filter_map` instead: `.filter_map(|x| x.checked_add(1))` |
26 | 26 |
|
27 | 27 | error: called `map(..).flatten()` on an `Iterator` |
28 | | - --> $DIR/map_flatten.rs:22:46 |
| 28 | + --> $DIR/map_flatten.rs:23:46 |
29 | 29 | | |
30 | 30 | LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(|x| 0..x).flatten().collect(); |
31 | 31 | | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try using `flat_map` instead: `.flat_map(|x| 0..x)` |
32 | 32 |
|
33 | 33 | error: called `map(..).flatten()` on an `Option` |
34 | | - --> $DIR/map_flatten.rs:25:39 |
| 34 | + --> $DIR/map_flatten.rs:26:39 |
35 | 35 | | |
36 | 36 | LL | let _: Option<_> = (Some(Some(1))).map(|x| x).flatten(); |
37 | 37 | | ^^^^^^^^^^^^^^^^^^^^^ help: try using `and_then` instead: `.and_then(|x| x)` |
38 | 38 |
|
39 | | -error: aborting due to 6 previous errors |
| 39 | +error: called `map(..).flatten()` on an `Result` |
| 40 | + --> $DIR/map_flatten.rs:29:41 |
| 41 | + | |
| 42 | +LL | let _: Result<_, &str> = (Ok(Ok(1))).map(|x| x).flatten(); |
| 43 | + | ^^^^^^^^^^^^^^^^^^^^^ help: try using `and_then` instead: `.and_then(|x| x)` |
| 44 | + |
| 45 | +error: aborting due to 7 previous errors |
40 | 46 |
|
0 commit comments