Skip to content

Commit 483e140

Browse files
committed
map_flatten: make it a rustfix test
1 parent d29f6d2 commit 483e140

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

tests/ui/map_flatten.fixed

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// run-rustfix
2+
3+
#![warn(clippy::all, clippy::pedantic)]
4+
#![allow(clippy::missing_docs_in_private_items)]
5+
6+
fn main() {
7+
let _: Vec<_> = vec![5_i8; 6].into_iter().flat_map(|x| 0..x).collect();
8+
}

tests/ui/map_flatten.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// run-rustfix
2+
13
#![warn(clippy::all, clippy::pedantic)]
24
#![allow(clippy::missing_docs_in_private_items)]
35

tests/ui/map_flatten.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: called `map(..).flatten()` on an `Iterator`. This is more succinctly expressed by calling `.flat_map(..)`
2-
--> $DIR/map_flatten.rs:5:21
2+
--> $DIR/map_flatten.rs:7:21
33
|
44
LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(|x| 0..x).flatten().collect();
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using flat_map instead: `vec![5_i8; 6].into_iter().flat_map(|x| 0..x)`

0 commit comments

Comments
 (0)