about summary refs log tree commit diff
path: root/src/tools/clippy/tests/ui/flat_map_option.rs
blob: 6784100a4fc9b4ba878f2907516a1cc9f4917e8e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#![warn(clippy::flat_map_option)]
#![allow(clippy::redundant_closure, clippy::unnecessary_filter_map)]

fn main() {
    // yay
    let c = |x| Some(x);
    let _ = [1].iter().flat_map(c);
    //~^ flat_map_option
    let _ = [1].iter().flat_map(Some);
    //~^ flat_map_option

    // nay
    let _ = [1].iter().flat_map(|_| &Some(1));
}