error: called `filter(p).map(q)` on an `Iterator`. This is more succinctly expressed by calling `.filter_map(..)` instead.
- --> $DIR/filter_methods.rs:8:21
+ --> $DIR/filter_methods.rs:5:21
|
-8 | let _: Vec<_> = vec![5; 6].into_iter()
- | _____________________^ starting here...
-9 | | .filter(|&x| x == 0)
-10 | | .map(|x| x * 2)
- | |_____________________________________________^ ...ending here
+LL | let _: Vec<_> = vec![5; 6].into_iter().filter(|&x| x == 0).map(|x| x * 2).collect();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
- = note: #[deny(filter_map)] implied by #[deny(clippy_pedantic)]
-note: lint level defined here
- --> $DIR/filter_methods.rs:4:17
- |
-4 | #![deny(clippy, clippy_pedantic)]
- | ^^^^^^^^^^^^^^^
+ = note: `-D clippy::filter-map` implied by `-D warnings`
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.
- --> $DIR/filter_methods.rs:13:21
- |
-13 | let _: Vec<_> = vec![5_i8; 6].into_iter()
- | _____________________^ starting here...
-14 | | .filter(|&x| x == 0)
-15 | | .flat_map(|x| x.checked_mul(2))
- | |_______________________________________________________________^ ...ending here
- |
- = note: #[deny(filter_map)] implied by #[deny(clippy_pedantic)]
+ --> $DIR/filter_methods.rs:7:21
+ |
+LL | let _: Vec<_> = vec![5_i8; 6]
+ | _____________________^
+LL | | .into_iter()
+LL | | .filter(|&x| x == 0)
+LL | | .flat_map(|x| x.checked_mul(2))
+ | |_______________________________________^
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.
- --> $DIR/filter_methods.rs:18:21
- |
-18 | let _: Vec<_> = vec![5_i8; 6].into_iter()
- | _____________________^ starting here...
-19 | | .filter_map(|x| x.checked_mul(2))
-20 | | .flat_map(|x| x.checked_mul(2))
- | |_______________________________________________________________^ ...ending here
+ --> $DIR/filter_methods.rs:13:21
|
- = note: #[deny(filter_map)] implied by #[deny(clippy_pedantic)]
+LL | let _: Vec<_> = vec![5_i8; 6]
+ | _____________________^
+LL | | .into_iter()
+LL | | .filter_map(|x| x.checked_mul(2))
+LL | | .flat_map(|x| x.checked_mul(2))
+ | |_______________________________________^
error: called `filter_map(p).map(q)` on an `Iterator`. This is more succinctly expressed by only calling `.filter_map(..)` instead.
- --> $DIR/filter_methods.rs:23:21
- |
-23 | let _: Vec<_> = vec![5_i8; 6].into_iter()
- | _____________________^ starting here...
-24 | | .filter_map(|x| x.checked_mul(2))
-25 | | .map(|x| x.checked_mul(2))
- | |__________________________________________________________^ ...ending here
- |
- = note: #[deny(filter_map)] implied by #[deny(clippy_pedantic)]
+ --> $DIR/filter_methods.rs:19:21
+ |
+LL | let _: Vec<_> = vec![5_i8; 6]
+ | _____________________^
+LL | | .into_iter()
+LL | | .filter_map(|x| x.checked_mul(2))
+LL | | .map(|x| x.checked_mul(2))
+ | |__________________________________^
error: aborting due to 4 previous errors