Deprecate filter_map
This commit is contained in:
parent
75efc144e7
commit
a45faf66f3
12 changed files with 23 additions and 161 deletions
|
|
@ -11,5 +11,6 @@
|
|||
#[warn(clippy::panic_params)]
|
||||
#[warn(clippy::unknown_clippy_lints)]
|
||||
#[warn(clippy::find_map)]
|
||||
#[warn(clippy::filter_map)]
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -78,11 +78,17 @@ error: lint `clippy::find_map` has been removed: this lint has been replaced by
|
|||
LL | #[warn(clippy::find_map)]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: lint `clippy::filter_map` has been removed: this lint has been replaced by `manual_filter_map`, a more specific lint
|
||||
--> $DIR/deprecated.rs:14:8
|
||||
|
|
||||
LL | #[warn(clippy::filter_map)]
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: lint `clippy::unstable_as_slice` has been removed: `Vec::as_slice` has been stabilized in 1.7
|
||||
--> $DIR/deprecated.rs:1:8
|
||||
|
|
||||
LL | #[warn(clippy::unstable_as_slice)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 14 previous errors
|
||||
error: aborting due to 15 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -1,25 +0,0 @@
|
|||
#![warn(clippy::all, clippy::pedantic)]
|
||||
#![allow(clippy::clippy::let_underscore_drop)]
|
||||
#![allow(clippy::missing_docs_in_private_items)]
|
||||
|
||||
fn main() {
|
||||
let _: Vec<_> = vec![5; 6].into_iter().filter(|&x| x == 0).map(|x| x * 2).collect();
|
||||
|
||||
let _: Vec<_> = vec![5_i8; 6]
|
||||
.into_iter()
|
||||
.filter(|&x| x == 0)
|
||||
.flat_map(|x| x.checked_mul(2))
|
||||
.collect();
|
||||
|
||||
let _: Vec<_> = vec![5_i8; 6]
|
||||
.into_iter()
|
||||
.filter_map(|x| x.checked_mul(2))
|
||||
.flat_map(|x| x.checked_mul(2))
|
||||
.collect();
|
||||
|
||||
let _: Vec<_> = vec![5_i8; 6]
|
||||
.into_iter()
|
||||
.filter_map(|x| x.checked_mul(2))
|
||||
.map(|x| x.checked_mul(2))
|
||||
.collect();
|
||||
}
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
error: called `filter(..).flat_map(..)` on an `Iterator`
|
||||
--> $DIR/filter_methods.rs:8:21
|
||||
|
|
||||
LL | let _: Vec<_> = vec![5_i8; 6]
|
||||
| _____________________^
|
||||
LL | | .into_iter()
|
||||
LL | | .filter(|&x| x == 0)
|
||||
LL | | .flat_map(|x| x.checked_mul(2))
|
||||
| |_______________________________________^
|
||||
|
|
||||
= note: `-D clippy::filter-map` implied by `-D warnings`
|
||||
= help: this is more succinctly expressed by calling `.flat_map(..)` and filtering by returning `iter::empty()`
|
||||
|
||||
error: called `filter_map(..).flat_map(..)` on an `Iterator`
|
||||
--> $DIR/filter_methods.rs:14:21
|
||||
|
|
||||
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))
|
||||
| |_______________________________________^
|
||||
|
|
||||
= help: this is more succinctly expressed by calling `.flat_map(..)` and filtering by returning `iter::empty()`
|
||||
|
||||
error: called `filter_map(..).map(..)` on an `Iterator`
|
||||
--> $DIR/filter_methods.rs:20: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))
|
||||
| |__________________________________^
|
||||
|
|
||||
= help: this is more succinctly expressed by only calling `.filter_map(..)` instead
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue