Skip to content

Commit 4852cca

Browse files
committed
Allow let_underscore_drop in filter_methods test
1 parent 06e81bb commit 4852cca

File tree

2 files changed

+6
-50
lines changed

2 files changed

+6
-50
lines changed

tests/ui/filter_methods.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![warn(clippy::all, clippy::pedantic)]
2+
#![allow(clippy::clippy::let_underscore_drop)]
23
#![allow(clippy::missing_docs_in_private_items)]
34

45
fn main() {

tests/ui/filter_methods.stderr

Lines changed: 5 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,14 @@
1-
error: non-binding `let` on a type that implements `Drop`
2-
--> $DIR/filter_methods.rs:5:5
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::let-underscore-drop` implied by `-D warnings`
8-
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
9-
101
error: called `filter(..).map(..)` on an `Iterator`
11-
--> $DIR/filter_methods.rs:5:21
2+
--> $DIR/filter_methods.rs:6:21
123
|
134
LL | let _: Vec<_> = vec![5; 6].into_iter().filter(|&x| x == 0).map(|x| x * 2).collect();
145
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
156
|
167
= note: `-D clippy::filter-map` implied by `-D warnings`
178
= help: this is more succinctly expressed by calling `.filter_map(..)` instead
189

19-
error: non-binding `let` on a type that implements `Drop`
20-
--> $DIR/filter_methods.rs:7:5
21-
|
22-
LL | / let _: Vec<_> = vec![5_i8; 6]
23-
LL | | .into_iter()
24-
LL | | .filter(|&x| x == 0)
25-
LL | | .flat_map(|x| x.checked_mul(2))
26-
LL | | .collect();
27-
| |___________________^
28-
|
29-
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
30-
3110
error: called `filter(..).flat_map(..)` on an `Iterator`
32-
--> $DIR/filter_methods.rs:7:21
11+
--> $DIR/filter_methods.rs:8:21
3312
|
3413
LL | let _: Vec<_> = vec![5_i8; 6]
3514
| _____________________^
@@ -40,20 +19,8 @@ LL | | .flat_map(|x| x.checked_mul(2))
4019
|
4120
= help: this is more succinctly expressed by calling `.flat_map(..)` and filtering by returning `iter::empty()`
4221

43-
error: non-binding `let` on a type that implements `Drop`
44-
--> $DIR/filter_methods.rs:13:5
45-
|
46-
LL | / let _: Vec<_> = vec![5_i8; 6]
47-
LL | | .into_iter()
48-
LL | | .filter_map(|x| x.checked_mul(2))
49-
LL | | .flat_map(|x| x.checked_mul(2))
50-
LL | | .collect();
51-
| |___________________^
52-
|
53-
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
54-
5522
error: called `filter_map(..).flat_map(..)` on an `Iterator`
56-
--> $DIR/filter_methods.rs:13:21
23+
--> $DIR/filter_methods.rs:14:21
5724
|
5825
LL | let _: Vec<_> = vec![5_i8; 6]
5926
| _____________________^
@@ -64,20 +31,8 @@ LL | | .flat_map(|x| x.checked_mul(2))
6431
|
6532
= help: this is more succinctly expressed by calling `.flat_map(..)` and filtering by returning `iter::empty()`
6633

67-
error: non-binding `let` on a type that implements `Drop`
68-
--> $DIR/filter_methods.rs:19:5
69-
|
70-
LL | / let _: Vec<_> = vec![5_i8; 6]
71-
LL | | .into_iter()
72-
LL | | .filter_map(|x| x.checked_mul(2))
73-
LL | | .map(|x| x.checked_mul(2))
74-
LL | | .collect();
75-
| |___________________^
76-
|
77-
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
78-
7934
error: called `filter_map(..).map(..)` on an `Iterator`
80-
--> $DIR/filter_methods.rs:19:21
35+
--> $DIR/filter_methods.rs:20:21
8136
|
8237
LL | let _: Vec<_> = vec![5_i8; 6]
8338
| _____________________^
@@ -88,5 +43,5 @@ LL | | .map(|x| x.checked_mul(2))
8843
|
8944
= help: this is more succinctly expressed by only calling `.filter_map(..)` instead
9045

91-
error: aborting due to 8 previous errors
46+
error: aborting due to 4 previous errors
9247

0 commit comments

Comments
 (0)