]> git.lizzy.rs Git - rust.git/blob - tests/ui/filter_methods.stderr
Auto merge of #3603 - xfix:random-state-lint, r=phansch
[rust.git] / tests / ui / filter_methods.stderr
1 error: called `filter(p).map(q)` on an `Iterator`. This is more succinctly expressed by calling `.filter_map(..)` instead.
2   --> $DIR/filter_methods.rs:14:21
3    |
4 LL |     let _: Vec<_> = vec![5; 6].into_iter().filter(|&x| x == 0).map(|x| x * 2).collect();
5    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6    |
7    = note: `-D clippy::filter-map` implied by `-D warnings`
8
9 error: called `filter(p).flat_map(q)` on an `Iterator`. This is more succinctly expressed by calling `.flat_map(..)` and filtering by returning an empty Iterator.
10   --> $DIR/filter_methods.rs:16:21
11    |
12 LL |       let _: Vec<_> = vec![5_i8; 6]
13    |  _____________________^
14 LL | |         .into_iter()
15 LL | |         .filter(|&x| x == 0)
16 LL | |         .flat_map(|x| x.checked_mul(2))
17    | |_______________________________________^
18
19 error: called `filter_map(p).flat_map(q)` on an `Iterator`. This is more succinctly expressed by calling `.flat_map(..)` and filtering by returning an empty Iterator.
20   --> $DIR/filter_methods.rs:22:21
21    |
22 LL |       let _: Vec<_> = vec![5_i8; 6]
23    |  _____________________^
24 LL | |         .into_iter()
25 LL | |         .filter_map(|x| x.checked_mul(2))
26 LL | |         .flat_map(|x| x.checked_mul(2))
27    | |_______________________________________^
28
29 error: called `filter_map(p).map(q)` on an `Iterator`. This is more succinctly expressed by only calling `.filter_map(..)` instead.
30   --> $DIR/filter_methods.rs:28:21
31    |
32 LL |       let _: Vec<_> = vec![5_i8; 6]
33    |  _____________________^
34 LL | |         .into_iter()
35 LL | |         .filter_map(|x| x.checked_mul(2))
36 LL | |         .map(|x| x.checked_mul(2))
37    | |__________________________________^
38
39 error: aborting due to 4 previous errors
40