]> git.proxmox.com Git - rustc.git/blob - src/tools/clippy/tests/ui/filter_methods.rs
New upstream version 1.23.0+dfsg1
[rustc.git] / src / tools / clippy / tests / ui / filter_methods.rs
1
2
3
4 #![warn(clippy, clippy_pedantic)]
5 #![allow(missing_docs_in_private_items)]
6
7 fn main() {
8 let _: Vec<_> = vec![5; 6].into_iter()
9 .filter(|&x| x == 0)
10 .map(|x| x * 2)
11 .collect();
12
13 let _: Vec<_> = vec![5_i8; 6].into_iter()
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()
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()
24 .filter_map(|x| x.checked_mul(2))
25 .map(|x| x.checked_mul(2))
26 .collect();
27 }