summary refs log tree commit diff
path: root/src/tools/clippy/tests/ui/flat_map_identity.rs
blob: 5607683a5d04e72682e89c0b500a758d020df6cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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);
}