diff --git a/tests/ui/unnecessary_flat_map.fixed b/tests/ui/unnecessary_flat_map.fixed index a5f24a4aa..dfe3bd47e 100644 --- a/tests/ui/unnecessary_flat_map.fixed +++ b/tests/ui/unnecessary_flat_map.fixed @@ -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(); } diff --git a/tests/ui/unnecessary_flat_map.rs b/tests/ui/unnecessary_flat_map.rs index 32eaef475..393b95692 100644 --- a/tests/ui/unnecessary_flat_map.rs +++ b/tests/ui/unnecessary_flat_map.rs @@ -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); } diff --git a/tests/ui/unnecessary_flat_map.stderr b/tests/ui/unnecessary_flat_map.stderr index 968a1e010..a1cd5745e 100644 --- a/tests/ui/unnecessary_flat_map.stderr +++ b/tests/ui/unnecessary_flat_map.stderr @@ -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