summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/flat_map_option.fixed
blob: e08d9a14533b21d9720cc266b4ee63cd74d33c50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#![warn(clippy::flat_map_option)]
#![allow(clippy::redundant_closure, clippy::unnecessary_filter_map)]

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

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