summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/filter_map_next.rs
blob: dbeb2354309c92bb4a66b2288ab2a7ec7ac905e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#![warn(clippy::all, clippy::pedantic)]

fn main() {
    let a = ["1", "lol", "3", "NaN", "5"];

    #[rustfmt::skip]
    let _: Option<u32> = vec![1, 2, 3, 4, 5, 6]
        .into_iter()
        .filter_map(|x| {
            if x == 2 {
                Some(x * 2)
            } else {
                None
            }
        })
        .next();
}