Add test for unnecessary_flat_map

This commit is contained in:
Jeremy Stucki 2019-06-24 11:21:29 +02:00
parent 316da7eb41
commit 1fd617d6df
No known key found for this signature in database
GPG Key ID: 8F548A5A2ED13F58
2 changed files with 16 additions and 0 deletions

View File

@ -0,0 +1,6 @@
#![warn(clippy::flat_map)]
fn main() {
let iterator = [[0, 1], [2, 3], [4, 5]].iter();
iterator.flat_map(|x| x);
}

View File

@ -0,0 +1,10 @@
error: called `flat_map(|x| x)` on an `Iterator`. This can be simplified by calling `flatten().`
--> $DIR/unnecessary_flat_map.rs:5:5
|
LL | iterator.flat_map(|x| x);
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::flat-map` implied by `-D warnings`
error: aborting due to previous error