]> git.proxmox.com Git - rustc.git/blob - tests/ui/lint/lint_map_unit_fn.rs
New upstream version 1.69.0+dfsg1
[rustc.git] / tests / ui / lint / lint_map_unit_fn.rs
1 #![deny(map_unit_fn)]
2
3 fn foo(items: &mut Vec<u8>) {
4 items.sort();
5 }
6
7 fn main() {
8 let mut x: Vec<Vec<u8>> = vec![vec![0, 2, 1], vec![5, 4, 3]];
9 x.iter_mut().map(foo);
10 //~^ ERROR `Iterator::map` call that discard the iterator's values
11 x.iter_mut().map(|items| {
12 //~^ ERROR `Iterator::map` call that discard the iterator's values
13 items.sort();
14 });
15 let f = |items: &mut Vec<u8>| {
16 items.sort();
17 };
18 x.iter_mut().map(f);
19 //~^ ERROR `Iterator::map` call that discard the iterator's values
20 }