]> git.lizzy.rs Git - rust.git/commitdiff
add tests
authorOliver Schneider <git-spam-no-reply9815368754983@oli-obk.de>
Tue, 21 Jun 2016 11:48:56 +0000 (13:48 +0200)
committerOliver Schneider <git-spam-no-reply9815368754983@oli-obk.de>
Tue, 21 Jun 2016 11:48:56 +0000 (13:48 +0200)
tests/compile-fail/filter_methods.rs [new file with mode: 0644]

diff --git a/tests/compile-fail/filter_methods.rs b/tests/compile-fail/filter_methods.rs
new file mode 100644 (file)
index 0000000..2a0e415
--- /dev/null
@@ -0,0 +1,15 @@
+#![feature(plugin)]
+#![plugin(clippy)]
+
+#![deny(clippy, clippy_pedantic)]
+fn main() {
+    let _: Vec<_> = vec![5; 6].into_iter() //~ERROR called `filter(p).map(q)` on an Iterator
+                              .filter(|&x| x == 0)
+                              .map(|x| x * 2)
+                              .collect();
+
+    let _: Vec<_> = vec![5i8; 6].into_iter() //~ERROR called `filter(p).flat_map(q)` on an Iterator
+                                .filter(|&x| x == 0)
+                                .flat_map(|x| x.checked_mul(2))
+                                .collect();
+}