From eef439cb78d7efbf24856c81a78e2b38ebfbc189 Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Tue, 21 Jun 2016 13:48:56 +0200 Subject: [PATCH] add tests --- tests/compile-fail/filter_methods.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 tests/compile-fail/filter_methods.rs diff --git a/tests/compile-fail/filter_methods.rs b/tests/compile-fail/filter_methods.rs new file mode 100644 index 000000000000..2a0e4156ceba --- /dev/null +++ b/tests/compile-fail/filter_methods.rs @@ -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(); +}