Skip to content

Commit 9c6a0b9

Browse files
committed
Update references
1 parent f1f780c commit 9c6a0b9

23 files changed

+533
-21
lines changed

tests/ui/borrow_box.stderr

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@ error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
2222
LL | fn test4(a: &Box<bool>);
2323
| ^^^^^^^^^^ help: try: `&bool`
2424

25+
error: non-binding let on a type that implements `Drop`
26+
--> $DIR/borrow_box.rs:63:5
27+
|
28+
LL | let _ = foo;
29+
| ^^^^^^^^^^^^
30+
|
31+
= note: `#[deny(clippy::let_underscore_drop)]` on by default
32+
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
33+
2534
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
2635
--> $DIR/borrow_box.rs:95:25
2736
|
@@ -64,5 +73,5 @@ error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
6473
LL | pub fn test20(_display: &Box<(dyn Display + Send)>) {}
6574
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&(dyn Display + Send)`
6675

67-
error: aborting due to 10 previous errors
76+
error: aborting due to 11 previous errors
6877

tests/ui/borrow_interior_mutable_const/others.stderr

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,15 @@ LL | let _once_mut = &mut ONCE_INIT; //~ ERROR interior mutability
4747
|
4848
= help: assign this const to a local or static variable, and use the variable here
4949

50+
error: non-binding let on a type that implements `Drop`
51+
--> $DIR/others.rs:72:5
52+
|
53+
LL | let _ = &ATOMIC_TUPLE; //~ ERROR interior mutability
54+
| ^^^^^^^^^^^^^^^^^^^^^^
55+
|
56+
= note: `#[deny(clippy::let_underscore_drop)]` on by default
57+
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
58+
5059
error: a `const` item with interior mutability should not be borrowed
5160
--> $DIR/others.rs:72:14
5261
|
@@ -95,6 +104,22 @@ LL | let _ = ATOMIC_TUPLE.0[0]; //~ ERROR interior mutability
95104
|
96105
= help: assign this const to a local or static variable, and use the variable here
97106

107+
error: non-binding let on a type that implements `Drop`
108+
--> $DIR/others.rs:83:5
109+
|
110+
LL | let _ = ATOMIC_TUPLE.1.into_iter();
111+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
112+
|
113+
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
114+
115+
error: non-binding let on a type that implements `Drop`
116+
--> $DIR/others.rs:85:5
117+
|
118+
LL | let _ = &{ ATOMIC_TUPLE };
119+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
120+
|
121+
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
122+
98123
error: a `const` item with interior mutability should not be borrowed
99124
--> $DIR/others.rs:87:5
100125
|
@@ -111,5 +136,5 @@ LL | assert_eq!(CELL.get(), 6); //~ ERROR interior mutability
111136
|
112137
= help: assign this const to a local or static variable, and use the variable here
113138

114-
error: aborting due to 14 previous errors
139+
error: aborting due to 17 previous errors
115140

tests/ui/box_vec.stderr

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
error: non-binding let on a type that implements `Drop`
2+
--> $DIR/box_vec.rs:7:9
3+
|
4+
LL | let _: Box<$x> = Box::new($init);
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
...
7+
LL | boxit!(Vec::new(), Vec<u8>);
8+
| ---------------------------- in this macro invocation
9+
|
10+
= note: `-D clippy::let-underscore-drop` implied by `-D warnings`
11+
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
12+
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
13+
114
error: you seem to be trying to use `Box<Vec<T>>`. Consider using just `Vec<T>`
215
--> $DIR/box_vec.rs:14:18
316
|
@@ -7,5 +20,5 @@ LL | pub fn test(foo: Box<Vec<bool>>) {
720
= note: `-D clippy::box-vec` implied by `-D warnings`
821
= help: `Vec<T>` is already on the heap, `Box<Vec<T>>` makes an extra allocation.
922

10-
error: aborting due to previous error
23+
error: aborting due to 2 previous errors
1124

tests/ui/crashes/ice-4968.stderr

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error: non-binding let on a type that implements `Drop`
2+
--> $DIR/ice-4968.rs:16:9
3+
|
4+
LL | let _: Vec<ManuallyDrop<T::Assoc>> = mem::transmute(slice);
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: `#[deny(clippy::let_underscore_drop)]` on by default
8+
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
9+
10+
error: aborting due to previous error
11+

tests/ui/crashes/ice-5223.stderr

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error: non-binding let on a type that implements `Drop`
2+
--> $DIR/ice-5223.rs:14:9
3+
|
4+
LL | let _ = self.arr.iter().cloned().collect::<Vec<_>>();
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: `#[deny(clippy::let_underscore_drop)]` on by default
8+
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
9+
10+
error: aborting due to previous error
11+

tests/ui/escape_analysis.stderr

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,26 @@ error: local variable doesn't need to be boxed here
1212
LL | pub fn new(_needs_name: Box<PeekableSeekable<&()>>) -> () {}
1313
| ^^^^^^^^^^^
1414

15-
error: aborting due to 2 previous errors
15+
error: non-binding let on a type that implements `Drop`
16+
--> $DIR/escape_analysis.rs:166:9
17+
|
18+
LL | / let _ = move || {
19+
LL | | consume(x);
20+
LL | | };
21+
| |__________^
22+
|
23+
= note: `#[deny(clippy::let_underscore_drop)]` on by default
24+
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
25+
26+
error: non-binding let on a type that implements `Drop`
27+
--> $DIR/escape_analysis.rs:172:9
28+
|
29+
LL | / let _ = || {
30+
LL | | borrow(&x);
31+
LL | | };
32+
| |__________^
33+
|
34+
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
35+
36+
error: aborting due to 4 previous errors
1637

tests/ui/eta.stderr

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,15 @@ error: redundant closure found
6464
LL | let e: std::vec::Vec<char> = vec!['a', 'b', 'c'].iter().map(|c| c.to_ascii_uppercase()).collect();
6565
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove closure as shown: `char::to_ascii_uppercase`
6666

67+
error: non-binding let on a type that implements `Drop`
68+
--> $DIR/eta.rs:107:5
69+
|
70+
LL | let _: Vec<_> = arr.iter().map(|x| x.map_err(|e| some.take().unwrap()(e))).collect();
71+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
72+
|
73+
= note: `#[deny(clippy::let_underscore_drop)]` on by default
74+
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
75+
6776
error: redundant closure found
6877
--> $DIR/eta.rs:172:27
6978
|
@@ -76,5 +85,13 @@ error: redundant closure found
7685
LL | let a = Some(1u8).map(|a| closure(a));
7786
| ^^^^^^^^^^^^^^ help: remove closure as shown: `closure`
7887

79-
error: aborting due to 12 previous errors
88+
error: non-binding let on a type that implements `Drop`
89+
--> $DIR/eta.rs:203:5
90+
|
91+
LL | let _ = [Bar].iter().map(|s| s.to_string()).collect::<Vec<_>>();
92+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
93+
|
94+
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
95+
96+
error: aborting due to 14 previous errors
8097

tests/ui/filter_methods.stderr

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
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+
110
error: called `filter(..).map(..)` on an `Iterator`
211
--> $DIR/filter_methods.rs:5:21
312
|
@@ -7,6 +16,18 @@ LL | let _: Vec<_> = vec![5; 6].into_iter().filter(|&x| x == 0).map(|x| x *
716
= note: `-D clippy::filter-map` implied by `-D warnings`
817
= help: this is more succinctly expressed by calling `.filter_map(..)` instead
918

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+
1031
error: called `filter(..).flat_map(..)` on an `Iterator`
1132
--> $DIR/filter_methods.rs:7:21
1233
|
@@ -19,6 +40,18 @@ LL | | .flat_map(|x| x.checked_mul(2))
1940
|
2041
= help: this is more succinctly expressed by calling `.flat_map(..)` and filtering by returning `iter::empty()`
2142

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+
2255
error: called `filter_map(..).flat_map(..)` on an `Iterator`
2356
--> $DIR/filter_methods.rs:13:21
2457
|
@@ -31,6 +64,18 @@ LL | | .flat_map(|x| x.checked_mul(2))
3164
|
3265
= help: this is more succinctly expressed by calling `.flat_map(..)` and filtering by returning `iter::empty()`
3366

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+
3479
error: called `filter_map(..).map(..)` on an `Iterator`
3580
--> $DIR/filter_methods.rs:19:21
3681
|
@@ -43,5 +88,5 @@ LL | | .map(|x| x.checked_mul(2))
4388
|
4489
= help: this is more succinctly expressed by only calling `.filter_map(..)` instead
4590

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

tests/ui/get_unwrap.stderr

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,34 @@ error: called `.get_mut().unwrap()` on a VecDeque. Using `[]` is more clear and
7070
LL | *some_vecdeque.get_mut(0).unwrap() = 1;
7171
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `some_vecdeque[0]`
7272

73+
error: non-binding let on a type that implements `Drop`
74+
--> $DIR/get_unwrap.rs:59:9
75+
|
76+
LL | let _ = some_vec.get(0..1).unwrap().to_vec();
77+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
78+
|
79+
= note: `#[deny(clippy::let_underscore_drop)]` on by default
80+
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
81+
7382
error: called `.get().unwrap()` on a Vec. Using `[]` is more clear and more concise
7483
--> $DIR/get_unwrap.rs:59:17
7584
|
7685
LL | let _ = some_vec.get(0..1).unwrap().to_vec();
7786
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `some_vec[0..1]`
7887

88+
error: non-binding let on a type that implements `Drop`
89+
--> $DIR/get_unwrap.rs:60:9
90+
|
91+
LL | let _ = some_vec.get_mut(0..1).unwrap().to_vec();
92+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
93+
|
94+
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
95+
7996
error: called `.get_mut().unwrap()` on a Vec. Using `[]` is more clear and more concise
8097
--> $DIR/get_unwrap.rs:60:17
8198
|
8299
LL | let _ = some_vec.get_mut(0..1).unwrap().to_vec();
83100
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `some_vec[0..1]`
84101

85-
error: aborting due to 13 previous errors
102+
error: aborting due to 15 previous errors
86103

tests/ui/into_iter_on_ref.stderr

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
error: non-binding let on a type that implements `Drop`
2+
--> $DIR/into_iter_on_ref.rs:13:5
3+
|
4+
LL | let _ = vec![1, 2, 3].into_iter();
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: `#[deny(clippy::let_underscore_drop)]` on by default
8+
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
9+
110
error: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `Vec`
211
--> $DIR/into_iter_on_ref.rs:14:30
312
|
@@ -162,5 +171,5 @@ error: this `.into_iter()` call is equivalent to `.iter()` and will not consume
162171
LL | let _ = (&[1, 2, 3]).into_iter().next(); //~ WARN equivalent to .iter()
163172
| ^^^^^^^^^ help: call directly: `iter`
164173

165-
error: aborting due to 27 previous errors
174+
error: aborting due to 28 previous errors
166175

0 commit comments

Comments
 (0)