File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,6 +19,14 @@ fn main() {
1919 None
2020 }
2121 });
22+
23+ let element: Option<i32> = a
24+ // very important comment -- don't delete!
25+ .iter().find_map(|s| {
26+ // another extremely important comment
27+ s.parse().ok()
28+ });
29+ //~^^^^^^^^ filter_map_next
2230}
2331
2432#[clippy::msrv = "1.29"]
Original file line number Diff line number Diff line change @@ -21,6 +21,16 @@ fn main() {
2121 }
2222 } )
2323 . next ( ) ;
24+
25+ let element: Option < i32 > = a
26+ // very important comment -- don't delete!
27+ . iter ( )
28+ . filter_map ( |s| {
29+ // another extremely important comment
30+ s. parse ( ) . ok ( )
31+ } )
32+ . next ( ) ;
33+ //~^^^^^^^^ filter_map_next
2434}
2535
2636#[ clippy:: msrv = "1.29" ]
Original file line number Diff line number Diff line change @@ -38,7 +38,30 @@ LL ~ });
3838 |
3939
4040error: called `filter_map(..).next()` on an `Iterator`
41- --> tests/ui/filter_map_next.rs:35:26
41+ --> tests/ui/filter_map_next.rs:25:32
42+ |
43+ LL | let element: Option<i32> = a
44+ | ________________________________^
45+ LL | | // very important comment -- don't delete!
46+ LL | | .iter()
47+ LL | | .filter_map(|s| {
48+ ... |
49+ LL | | })
50+ LL | | .next();
51+ | |_______________^
52+ |
53+ help: use `.find_map(..)` instead
54+ |
55+ LL ~ let element: Option<i32> = a
56+ LL + // very important comment -- don't delete!
57+ LL + .iter().find_map(|s| {
58+ LL + // another extremely important comment
59+ LL + s.parse().ok()
60+ LL ~ });
61+ |
62+
63+ error: called `filter_map(..).next()` on an `Iterator`
64+ --> tests/ui/filter_map_next.rs:45:26
4265 |
4366LL | let _: Option<i32> = a.iter().filter_map(|s| s.parse().ok()).next();
4467 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -49,5 +72,5 @@ LL - let _: Option<i32> = a.iter().filter_map(|s| s.parse().ok()).next();
4972LL + let _: Option<i32> = a.iter().find_map(|s| s.parse().ok());
5073 |
5174
52- error: aborting due to 3 previous errors
75+ error: aborting due to 4 previous errors
5376
You can’t perform that action at this time.
0 commit comments