Add test for unnecessary_flat_map
This commit is contained in:
parent
316da7eb41
commit
1fd617d6df
6
tests/ui/unnecessary_flat_map.rs
Normal file
6
tests/ui/unnecessary_flat_map.rs
Normal 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);
|
||||
}
|
10
tests/ui/unnecessary_flat_map.stderr
Normal file
10
tests/ui/unnecessary_flat_map.stderr
Normal 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
|
||||
|
Loading…
Reference in New Issue
Block a user