summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/filter_map_next.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clippy/tests/ui/filter_map_next.rs')
-rw-r--r--src/tools/clippy/tests/ui/filter_map_next.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui/filter_map_next.rs b/src/tools/clippy/tests/ui/filter_map_next.rs
new file mode 100644
index 000000000..dbeb23543
--- /dev/null
+++ b/src/tools/clippy/tests/ui/filter_map_next.rs
@@ -0,0 +1,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();
+}