rust/tests/ui/flat_map_identity.rs

18 lines
428 B
Rust
Raw Normal View History

//@run-rustfix
2019-08-12 14:42:57 -05:00
#![allow(unused_imports, clippy::needless_return)]
#![warn(clippy::flat_map_identity)]
2019-06-24 04:21:29 -05:00
use std::convert;
2019-06-24 04:21:29 -05:00
fn main() {
let iterator = [[0, 1], [2, 3], [4, 5]].iter();
2019-08-13 14:50:52 -05:00
let _ = iterator.flat_map(|x| x);
let iterator = [[0, 1], [2, 3], [4, 5]].iter();
2019-08-13 14:50:52 -05:00
let _ = iterator.flat_map(convert::identity);
let iterator = [[0, 1], [2, 3], [4, 5]].iter();
let _ = iterator.flat_map(|x| return x);
2019-06-24 04:21:29 -05:00
}