map_flatten: make it a rustfix test
This commit is contained in:
parent
d29f6d28b5
commit
483e140bce
8
tests/ui/map_flatten.fixed
Normal file
8
tests/ui/map_flatten.fixed
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
// run-rustfix
|
||||||
|
|
||||||
|
#![warn(clippy::all, clippy::pedantic)]
|
||||||
|
#![allow(clippy::missing_docs_in_private_items)]
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let _: Vec<_> = vec![5_i8; 6].into_iter().flat_map(|x| 0..x).collect();
|
||||||
|
}
|
@ -1,3 +1,5 @@
|
|||||||
|
// run-rustfix
|
||||||
|
|
||||||
#![warn(clippy::all, clippy::pedantic)]
|
#![warn(clippy::all, clippy::pedantic)]
|
||||||
#![allow(clippy::missing_docs_in_private_items)]
|
#![allow(clippy::missing_docs_in_private_items)]
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
error: called `map(..).flatten()` on an `Iterator`. This is more succinctly expressed by calling `.flat_map(..)`
|
error: called `map(..).flatten()` on an `Iterator`. This is more succinctly expressed by calling `.flat_map(..)`
|
||||||
--> $DIR/map_flatten.rs:5:21
|
--> $DIR/map_flatten.rs:7:21
|
||||||
|
|
|
|
||||||
LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(|x| 0..x).flatten().collect();
|
LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(|x| 0..x).flatten().collect();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using flat_map instead: `vec![5_i8; 6].into_iter().flat_map(|x| 0..x)`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using flat_map instead: `vec![5_i8; 6].into_iter().flat_map(|x| 0..x)`
|
||||||
|
Loading…
Reference in New Issue
Block a user