diff options
Diffstat (limited to '')
-rw-r--r-- | src/tools/clippy/tests/ui/flat_map_identity.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui/flat_map_identity.rs b/src/tools/clippy/tests/ui/flat_map_identity.rs new file mode 100644 index 000000000..de14a06d4 --- /dev/null +++ b/src/tools/clippy/tests/ui/flat_map_identity.rs @@ -0,0 +1,17 @@ +// run-rustfix + +#![allow(unused_imports, clippy::needless_return)] +#![warn(clippy::flat_map_identity)] + +use std::convert; + +fn main() { + let iterator = [[0, 1], [2, 3], [4, 5]].iter(); + let _ = iterator.flat_map(|x| x); + + let iterator = [[0, 1], [2, 3], [4, 5]].iter(); + let _ = iterator.flat_map(convert::identity); + + let iterator = [[0, 1], [2, 3], [4, 5]].iter(); + let _ = iterator.flat_map(|x| return x); +} |