Update test

This commit is contained in:
Jeremy Stucki 2019-08-13 21:50:52 +02:00
parent d578c43c51
commit 2fe5e2cea9
No known key found for this signature in database
GPG key ID: 8F548A5A2ED13F58
3 changed files with 12 additions and 10 deletions

View file

@ -1,13 +1,14 @@
// run-rustfix
#![allow(unused_imports)]
#![warn(clippy::flat_map_identity)]
use std::convert;
fn main() {
let iterator = [[0, 1], [2, 3], [4, 5]].iter();
iterator.flatten();
let _ = iterator.flatten();
let iterator = [[0, 1], [2, 3], [4, 5]].iter();
iterator.flatten();
let _ = iterator.flatten();
}

View file

@ -1,13 +1,14 @@
// run-rustfix
#![allow(unused_imports)]
#![warn(clippy::flat_map_identity)]
use std::convert;
fn main() {
let iterator = [[0, 1], [2, 3], [4, 5]].iter();
iterator.flat_map(|x| x);
let _ = iterator.flat_map(|x| x);
let iterator = [[0, 1], [2, 3], [4, 5]].iter();
iterator.flat_map(convert::identity);
let _ = iterator.flat_map(convert::identity);
}

View file

@ -1,16 +1,16 @@
error: called `flat_map(|x| x)` on an `Iterator`
--> $DIR/unnecessary_flat_map.rs:9:14
--> $DIR/unnecessary_flat_map.rs:10:22
|
LL | iterator.flat_map(|x| x);
| ^^^^^^^^^^^^^^^ help: try: `flatten()`
LL | let _ = iterator.flat_map(|x| x);
| ^^^^^^^^^^^^^^^ help: try: `flatten()`
|
= note: `-D clippy::flat-map-identity` implied by `-D warnings`
error: called `flat_map(std::convert::identity)` on an `Iterator`
--> $DIR/unnecessary_flat_map.rs:12:14
--> $DIR/unnecessary_flat_map.rs:13:22
|
LL | iterator.flat_map(convert::identity);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `flatten()`
LL | let _ = iterator.flat_map(convert::identity);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `flatten()`
error: aborting due to 2 previous errors