]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/filter_methods.rs
Add 'src/tools/clippy/' from commit 'd2708873ef711ec8ab45df1e984ecf24a96cd369'
[rust.git] / src / tools / clippy / tests / ui / filter_methods.rs
1 #![warn(clippy::all, clippy::pedantic)]
2 #![allow(clippy::missing_docs_in_private_items)]
3
4 fn main() {
5     let _: Vec<_> = vec![5; 6].into_iter().filter(|&x| x == 0).map(|x| x * 2).collect();
6
7     let _: Vec<_> = vec![5_i8; 6]
8         .into_iter()
9         .filter(|&x| x == 0)
10         .flat_map(|x| x.checked_mul(2))
11         .collect();
12
13     let _: Vec<_> = vec![5_i8; 6]
14         .into_iter()
15         .filter_map(|x| x.checked_mul(2))
16         .flat_map(|x| x.checked_mul(2))
17         .collect();
18
19     let _: Vec<_> = vec![5_i8; 6]
20         .into_iter()
21         .filter_map(|x| x.checked_mul(2))
22         .map(|x| x.checked_mul(2))
23         .collect();
24 }