Allow let_underscore_drop
in filter_methods
test
This commit is contained in:
parent
06e81bb493
commit
4852cca61b
@ -1,4 +1,5 @@
|
||||
#![warn(clippy::all, clippy::pedantic)]
|
||||
#![allow(clippy::clippy::let_underscore_drop)]
|
||||
#![allow(clippy::missing_docs_in_private_items)]
|
||||
|
||||
fn main() {
|
||||
|
@ -1,14 +1,5 @@
|
||||
error: non-binding `let` on a type that implements `Drop`
|
||||
--> $DIR/filter_methods.rs:5:5
|
||||
|
|
||||
LL | let _: Vec<_> = vec![5; 6].into_iter().filter(|&x| x == 0).map(|x| x * 2).collect();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::let-underscore-drop` implied by `-D warnings`
|
||||
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
|
||||
|
||||
error: called `filter(..).map(..)` on an `Iterator`
|
||||
--> $DIR/filter_methods.rs:5:21
|
||||
--> $DIR/filter_methods.rs:6:21
|
||||
|
|
||||
LL | let _: Vec<_> = vec![5; 6].into_iter().filter(|&x| x == 0).map(|x| x * 2).collect();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -16,20 +7,8 @@ LL | let _: Vec<_> = vec![5; 6].into_iter().filter(|&x| x == 0).map(|x| x *
|
||||
= note: `-D clippy::filter-map` implied by `-D warnings`
|
||||
= help: this is more succinctly expressed by calling `.filter_map(..)` instead
|
||||
|
||||
error: non-binding `let` on a type that implements `Drop`
|
||||
--> $DIR/filter_methods.rs:7:5
|
||||
|
|
||||
LL | / let _: Vec<_> = vec![5_i8; 6]
|
||||
LL | | .into_iter()
|
||||
LL | | .filter(|&x| x == 0)
|
||||
LL | | .flat_map(|x| x.checked_mul(2))
|
||||
LL | | .collect();
|
||||
| |___________________^
|
||||
|
|
||||
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
|
||||
|
||||
error: called `filter(..).flat_map(..)` on an `Iterator`
|
||||
--> $DIR/filter_methods.rs:7:21
|
||||
--> $DIR/filter_methods.rs:8:21
|
||||
|
|
||||
LL | let _: Vec<_> = vec![5_i8; 6]
|
||||
| _____________________^
|
||||
@ -40,20 +19,8 @@ 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: non-binding `let` on a type that implements `Drop`
|
||||
--> $DIR/filter_methods.rs:13:5
|
||||
|
|
||||
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))
|
||||
LL | | .collect();
|
||||
| |___________________^
|
||||
|
|
||||
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
|
||||
|
||||
error: called `filter_map(..).flat_map(..)` on an `Iterator`
|
||||
--> $DIR/filter_methods.rs:13:21
|
||||
--> $DIR/filter_methods.rs:14:21
|
||||
|
|
||||
LL | let _: Vec<_> = vec![5_i8; 6]
|
||||
| _____________________^
|
||||
@ -64,20 +31,8 @@ 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: non-binding `let` on a type that implements `Drop`
|
||||
--> $DIR/filter_methods.rs:19:5
|
||||
|
|
||||
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))
|
||||
LL | | .collect();
|
||||
| |___________________^
|
||||
|
|
||||
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
|
||||
|
||||
error: called `filter_map(..).map(..)` on an `Iterator`
|
||||
--> $DIR/filter_methods.rs:19:21
|
||||
--> $DIR/filter_methods.rs:20:21
|
||||
|
|
||||
LL | let _: Vec<_> = vec![5_i8; 6]
|
||||
| _____________________^
|
||||
@ -88,5 +43,5 @@ LL | | .map(|x| x.checked_mul(2))
|
||||
|
|
||||
= help: this is more succinctly expressed by only calling `.filter_map(..)` instead
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user