From 483e140bcea938a119ae5a93109e9c8d3f2c4188 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Wed, 25 Sep 2019 04:50:23 -0700 Subject: [PATCH] map_flatten: make it a rustfix test --- tests/ui/map_flatten.fixed | 8 ++++++++ tests/ui/map_flatten.rs | 2 ++ tests/ui/map_flatten.stderr | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 tests/ui/map_flatten.fixed diff --git a/tests/ui/map_flatten.fixed b/tests/ui/map_flatten.fixed new file mode 100644 index 00000000000..51732e02be4 --- /dev/null +++ b/tests/ui/map_flatten.fixed @@ -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(); +} diff --git a/tests/ui/map_flatten.rs b/tests/ui/map_flatten.rs index d0720c419c8..66137a50ae8 100644 --- a/tests/ui/map_flatten.rs +++ b/tests/ui/map_flatten.rs @@ -1,3 +1,5 @@ +// run-rustfix + #![warn(clippy::all, clippy::pedantic)] #![allow(clippy::missing_docs_in_private_items)] diff --git a/tests/ui/map_flatten.stderr b/tests/ui/map_flatten.stderr index 822d27391f6..478c7e780d9 100644 --- a/tests/ui/map_flatten.stderr +++ b/tests/ui/map_flatten.stderr @@ -1,5 +1,5 @@ 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(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using flat_map instead: `vec![5_i8; 6].into_iter().flat_map(|x| 0..x)`