]> git.proxmox.com Git - rustc.git/blob - src/tools/clippy/tests/ui/filter_map_next_fixable.rs
New upstream version 1.66.0+dfsg1
[rustc.git] / src / tools / clippy / tests / ui / filter_map_next_fixable.rs
1 // run-rustfix
2
3 #![feature(custom_inner_attributes)]
4 #![warn(clippy::all, clippy::pedantic)]
5 #![allow(unused)]
6
7 fn main() {
8 let a = ["1", "lol", "3", "NaN", "5"];
9
10 let element: Option<i32> = a.iter().filter_map(|s| s.parse().ok()).next();
11 assert_eq!(element, Some(1));
12 }
13
14 fn msrv_1_29() {
15 #![clippy::msrv = "1.29"]
16
17 let a = ["1", "lol", "3", "NaN", "5"];
18 let _: Option<i32> = a.iter().filter_map(|s| s.parse().ok()).next();
19 }
20
21 fn msrv_1_30() {
22 #![clippy::msrv = "1.30"]
23
24 let a = ["1", "lol", "3", "NaN", "5"];
25 let _: Option<i32> = a.iter().filter_map(|s| s.parse().ok()).next();
26 }