summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/filter_map_next_fixable.fixed
blob: 41828ddd7acde22e0d7ad9e98a7df008a05b5d7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// run-rustfix

#![feature(custom_inner_attributes)]
#![warn(clippy::all, clippy::pedantic)]
#![allow(unused)]

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

    let element: Option<i32> = a.iter().find_map(|s| s.parse().ok());
    assert_eq!(element, Some(1));
}

fn msrv_1_29() {
    #![clippy::msrv = "1.29"]

    let a = ["1", "lol", "3", "NaN", "5"];
    let _: Option<i32> = a.iter().filter_map(|s| s.parse().ok()).next();
}

fn msrv_1_30() {
    #![clippy::msrv = "1.30"]

    let a = ["1", "lol", "3", "NaN", "5"];
    let _: Option<i32> = a.iter().find_map(|s| s.parse().ok());
}