]> git.lizzy.rs Git - rust.git/blob - tests/ui/filter_methods.rs
rustup and compile-fail -> ui test move
[rust.git] / tests / ui / filter_methods.rs
1 #![feature(plugin)]
2 #![plugin(clippy)]
3
4 #![deny(clippy, clippy_pedantic)]
5 #![allow(missing_docs_in_private_items)]
6
7 fn main() {
8     let _: Vec<_> = vec![5; 6].into_iter() //~ERROR called `filter(p).map(q)` on an `Iterator`
9                               .filter(|&x| x == 0)
10                               .map(|x| x * 2)
11                               .collect();
12
13     let _: Vec<_> = vec![5_i8; 6].into_iter() //~ERROR called `filter(p).flat_map(q)` on an `Iterator`
14                                 .filter(|&x| x == 0)
15                                 .flat_map(|x| x.checked_mul(2))
16                                 .collect();
17
18     let _: Vec<_> = vec![5_i8; 6].into_iter() //~ERROR called `filter_map(p).flat_map(q)` on an `Iterator`
19                                 .filter_map(|x| x.checked_mul(2))
20                                 .flat_map(|x| x.checked_mul(2))
21                                 .collect();
22
23     let _: Vec<_> = vec![5_i8; 6].into_iter() //~ERROR called `filter_map(p).map(q)` on an `Iterator`
24                                 .filter_map(|x| x.checked_mul(2))
25                                 .map(|x| x.checked_mul(2))
26                                 .collect();
27 }