mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 13:13:34 +00:00
Update test
This commit is contained in:
parent
d578c43c51
commit
2fe5e2cea9
3 changed files with 12 additions and 10 deletions
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue