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