diff options
Diffstat (limited to 'src/tools/clippy/tests/ui/filter_map_next_fixable.rs')
-rw-r--r-- | src/tools/clippy/tests/ui/filter_map_next_fixable.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui/filter_map_next_fixable.rs b/src/tools/clippy/tests/ui/filter_map_next_fixable.rs new file mode 100644 index 000000000..447219a96 --- /dev/null +++ b/src/tools/clippy/tests/ui/filter_map_next_fixable.rs @@ -0,0 +1,10 @@ +// run-rustfix + +#![warn(clippy::all, clippy::pedantic)] + +fn main() { + let a = ["1", "lol", "3", "NaN", "5"]; + + let element: Option<i32> = a.iter().filter_map(|s| s.parse().ok()).next(); + assert_eq!(element, Some(1)); +} |