Update references

This commit is contained in:
Samuel E. Moelius III 2020-11-08 07:07:49 -05:00
parent f1f780c942
commit 9c6a0b9c34
23 changed files with 533 additions and 21 deletions

View File

@ -22,6 +22,15 @@ error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
LL | fn test4(a: &Box<bool>);
| ^^^^^^^^^^ help: try: `&bool`
error: non-binding let on a type that implements `Drop`
--> $DIR/borrow_box.rs:63:5
|
LL | let _ = foo;
| ^^^^^^^^^^^^
|
= note: `#[deny(clippy::let_underscore_drop)]` on by default
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
--> $DIR/borrow_box.rs:95:25
|
@ -64,5 +73,5 @@ error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
LL | pub fn test20(_display: &Box<(dyn Display + Send)>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&(dyn Display + Send)`
error: aborting due to 10 previous errors
error: aborting due to 11 previous errors

View File

@ -47,6 +47,15 @@ LL | let _once_mut = &mut ONCE_INIT; //~ ERROR interior mutability
|
= help: assign this const to a local or static variable, and use the variable here
error: non-binding let on a type that implements `Drop`
--> $DIR/others.rs:72:5
|
LL | let _ = &ATOMIC_TUPLE; //~ ERROR interior mutability
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[deny(clippy::let_underscore_drop)]` on by default
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: a `const` item with interior mutability should not be borrowed
--> $DIR/others.rs:72:14
|
@ -95,6 +104,22 @@ LL | let _ = ATOMIC_TUPLE.0[0]; //~ ERROR interior mutability
|
= help: assign this const to a local or static variable, and use the variable here
error: non-binding let on a type that implements `Drop`
--> $DIR/others.rs:83:5
|
LL | let _ = ATOMIC_TUPLE.1.into_iter();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: non-binding let on a type that implements `Drop`
--> $DIR/others.rs:85:5
|
LL | let _ = &{ ATOMIC_TUPLE };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: a `const` item with interior mutability should not be borrowed
--> $DIR/others.rs:87:5
|
@ -111,5 +136,5 @@ LL | assert_eq!(CELL.get(), 6); //~ ERROR interior mutability
|
= help: assign this const to a local or static variable, and use the variable here
error: aborting due to 14 previous errors
error: aborting due to 17 previous errors

View File

@ -1,3 +1,16 @@
error: non-binding let on a type that implements `Drop`
--> $DIR/box_vec.rs:7:9
|
LL | let _: Box<$x> = Box::new($init);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
LL | boxit!(Vec::new(), Vec<u8>);
| ---------------------------- in this macro invocation
|
= 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`
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: you seem to be trying to use `Box<Vec<T>>`. Consider using just `Vec<T>`
--> $DIR/box_vec.rs:14:18
|
@ -7,5 +20,5 @@ LL | pub fn test(foo: Box<Vec<bool>>) {
= note: `-D clippy::box-vec` implied by `-D warnings`
= help: `Vec<T>` is already on the heap, `Box<Vec<T>>` makes an extra allocation.
error: aborting due to previous error
error: aborting due to 2 previous errors

View File

@ -0,0 +1,11 @@
error: non-binding let on a type that implements `Drop`
--> $DIR/ice-4968.rs:16:9
|
LL | let _: Vec<ManuallyDrop<T::Assoc>> = mem::transmute(slice);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[deny(clippy::let_underscore_drop)]` on by default
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: aborting due to previous error

View File

@ -0,0 +1,11 @@
error: non-binding let on a type that implements `Drop`
--> $DIR/ice-5223.rs:14:9
|
LL | let _ = self.arr.iter().cloned().collect::<Vec<_>>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[deny(clippy::let_underscore_drop)]` on by default
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: aborting due to previous error

View File

@ -12,5 +12,26 @@ error: local variable doesn't need to be boxed here
LL | pub fn new(_needs_name: Box<PeekableSeekable<&()>>) -> () {}
| ^^^^^^^^^^^
error: aborting due to 2 previous errors
error: non-binding let on a type that implements `Drop`
--> $DIR/escape_analysis.rs:166:9
|
LL | / let _ = move || {
LL | | consume(x);
LL | | };
| |__________^
|
= note: `#[deny(clippy::let_underscore_drop)]` on by default
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: non-binding let on a type that implements `Drop`
--> $DIR/escape_analysis.rs:172:9
|
LL | / let _ = || {
LL | | borrow(&x);
LL | | };
| |__________^
|
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: aborting due to 4 previous errors

View File

@ -64,6 +64,15 @@ error: redundant closure found
LL | let e: std::vec::Vec<char> = vec!['a', 'b', 'c'].iter().map(|c| c.to_ascii_uppercase()).collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove closure as shown: `char::to_ascii_uppercase`
error: non-binding let on a type that implements `Drop`
--> $DIR/eta.rs:107:5
|
LL | let _: Vec<_> = arr.iter().map(|x| x.map_err(|e| some.take().unwrap()(e))).collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[deny(clippy::let_underscore_drop)]` on by default
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: redundant closure found
--> $DIR/eta.rs:172:27
|
@ -76,5 +85,13 @@ error: redundant closure found
LL | let a = Some(1u8).map(|a| closure(a));
| ^^^^^^^^^^^^^^ help: remove closure as shown: `closure`
error: aborting due to 12 previous errors
error: non-binding let on a type that implements `Drop`
--> $DIR/eta.rs:203:5
|
LL | let _ = [Bar].iter().map(|s| s.to_string()).collect::<Vec<_>>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: aborting due to 14 previous errors

View File

@ -1,3 +1,12 @@
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
|
@ -7,6 +16,18 @@ 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
|
@ -19,6 +40,18 @@ 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
|
@ -31,6 +64,18 @@ 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
|
@ -43,5 +88,5 @@ LL | | .map(|x| x.checked_mul(2))
|
= help: this is more succinctly expressed by only calling `.filter_map(..)` instead
error: aborting due to 4 previous errors
error: aborting due to 8 previous errors

View File

@ -70,17 +70,34 @@ error: called `.get_mut().unwrap()` on a VecDeque. Using `[]` is more clear and
LL | *some_vecdeque.get_mut(0).unwrap() = 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `some_vecdeque[0]`
error: non-binding let on a type that implements `Drop`
--> $DIR/get_unwrap.rs:59:9
|
LL | let _ = some_vec.get(0..1).unwrap().to_vec();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[deny(clippy::let_underscore_drop)]` on by default
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: called `.get().unwrap()` on a Vec. Using `[]` is more clear and more concise
--> $DIR/get_unwrap.rs:59:17
|
LL | let _ = some_vec.get(0..1).unwrap().to_vec();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `some_vec[0..1]`
error: non-binding let on a type that implements `Drop`
--> $DIR/get_unwrap.rs:60:9
|
LL | let _ = some_vec.get_mut(0..1).unwrap().to_vec();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: called `.get_mut().unwrap()` on a Vec. Using `[]` is more clear and more concise
--> $DIR/get_unwrap.rs:60:17
|
LL | let _ = some_vec.get_mut(0..1).unwrap().to_vec();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `some_vec[0..1]`
error: aborting due to 13 previous errors
error: aborting due to 15 previous errors

View File

@ -1,3 +1,12 @@
error: non-binding let on a type that implements `Drop`
--> $DIR/into_iter_on_ref.rs:13:5
|
LL | let _ = vec![1, 2, 3].into_iter();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[deny(clippy::let_underscore_drop)]` on by default
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `Vec`
--> $DIR/into_iter_on_ref.rs:14:30
|
@ -162,5 +171,5 @@ error: this `.into_iter()` call is equivalent to `.iter()` and will not consume
LL | let _ = (&[1, 2, 3]).into_iter().next(); //~ WARN equivalent to .iter()
| ^^^^^^^^^ help: call directly: `iter`
error: aborting due to 27 previous errors
error: aborting due to 28 previous errors

View File

@ -6,12 +6,33 @@ LL | let v2: Vec<isize> = v.iter().cloned().collect();
|
= note: `-D clippy::iter-cloned-collect` implied by `-D warnings`
error: non-binding let on a type that implements `Drop`
--> $DIR/iter_cloned_collect.rs:15:5
|
LL | let _: Vec<isize> = vec![1, 2, 3].iter().cloned().collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[deny(clippy::let_underscore_drop)]` on by default
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: called `iter().cloned().collect()` on a slice to create a `Vec`. Calling `to_vec()` is both faster and more readable
--> $DIR/iter_cloned_collect.rs:15:38
|
LL | let _: Vec<isize> = vec![1, 2, 3].iter().cloned().collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `.to_vec()`
error: non-binding let on a type that implements `Drop`
--> $DIR/iter_cloned_collect.rs:19:9
|
LL | / let _: Vec<u8> = std::ffi::CStr::from_ptr(std::ptr::null())
LL | | .to_bytes()
LL | | .iter()
LL | | .cloned()
LL | | .collect();
| |_______________________^
|
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: called `iter().cloned().collect()` on a slice to create a `Vec`. Calling `to_vec()` is both faster and more readable
--> $DIR/iter_cloned_collect.rs:20:24
|
@ -22,5 +43,5 @@ LL | | .cloned()
LL | | .collect();
| |______________________^ help: try: `.to_vec()`
error: aborting due to 3 previous errors
error: aborting due to 5 previous errors

View File

@ -1,3 +1,12 @@
error: non-binding let on a type that implements `Drop`
--> $DIR/map_clone.rs:10:5
|
LL | let _: Vec<i8> = vec![5_i8; 6].iter().map(|x| *x).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: you are using an explicit closure for copying elements
--> $DIR/map_clone.rs:10:22
|
@ -6,12 +15,28 @@ LL | let _: Vec<i8> = vec![5_i8; 6].iter().map(|x| *x).collect();
|
= note: `-D clippy::map-clone` implied by `-D warnings`
error: non-binding let on a type that implements `Drop`
--> $DIR/map_clone.rs:11:5
|
LL | let _: Vec<String> = vec![String::new()].iter().map(|x| x.clone()).collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: you are using an explicit closure for cloning elements
--> $DIR/map_clone.rs:11:26
|
LL | let _: Vec<String> = vec![String::new()].iter().map(|x| x.clone()).collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `cloned` method: `vec![String::new()].iter().cloned()`
error: non-binding let on a type that implements `Drop`
--> $DIR/map_clone.rs:12:5
|
LL | let _: Vec<u32> = vec![42, 43].iter().map(|&x| x).collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: you are using an explicit closure for copying elements
--> $DIR/map_clone.rs:12:23
|
@ -36,5 +61,37 @@ error: you are needlessly cloning iterator elements
LL | let _ = std::env::args().map(|v| v.clone());
| ^^^^^^^^^^^^^^^^^^^ help: remove the `map` call
error: aborting due to 6 previous errors
error: non-binding let on a type that implements `Drop`
--> $DIR/map_clone.rs:35:9
|
LL | let _: Vec<u32> = v.into_iter().map(|x| *x).collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: non-binding let on a type that implements `Drop`
--> $DIR/map_clone.rs:42:9
|
LL | let _: Vec<u32> = v.into_iter().map(|x| *x).collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: non-binding let on a type that implements `Drop`
--> $DIR/map_clone.rs:45:9
|
LL | let _: Vec<u32> = v.into_iter().map(|&mut x| x).collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: non-binding let on a type that implements `Drop`
--> $DIR/map_clone.rs:53:9
|
LL | let _: Vec<_> = items.into_iter().map(|x| x.clone()).collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: aborting due to 13 previous errors

View File

@ -12,5 +12,22 @@ error: `.map().collect()` can be replaced with `.try_for_each()`
LL | let _: Result<(), _> = (0..3).map(|t| Err(t + 1)).collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `(0..3).try_for_each(|t| Err(t + 1))`
error: aborting due to 2 previous errors
error: non-binding let on a type that implements `Drop`
--> $DIR/map_collect_result_unit.rs:14:5
|
LL | let _ = (0..3).map(|t| Err(t + 1)).collect::<Result<Vec<i32>, _>>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[deny(clippy::let_underscore_drop)]` on by default
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: non-binding let on a type that implements `Drop`
--> $DIR/map_collect_result_unit.rs:15:5
|
LL | let _ = (0..3).map(|t| Err(t + 1)).collect::<Vec<Result<(), _>>>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: aborting due to 4 previous errors

View File

@ -1,3 +1,12 @@
error: non-binding let on a type that implements `Drop`
--> $DIR/map_flatten.rs:14:5
|
LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(option_id).flatten().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 `map(..).flatten()` on an `Iterator`
--> $DIR/map_flatten.rs:14:46
|
@ -6,24 +15,56 @@ LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(option_id).flatten().coll
|
= note: `-D clippy::map-flatten` implied by `-D warnings`
error: non-binding let on a type that implements `Drop`
--> $DIR/map_flatten.rs:15:5
|
LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(option_id_ref).flatten().collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: called `map(..).flatten()` on an `Iterator`
--> $DIR/map_flatten.rs:15:46
|
LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(option_id_ref).flatten().collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using `filter_map` instead: `.filter_map(option_id_ref)`
error: non-binding let on a type that implements `Drop`
--> $DIR/map_flatten.rs:16:5
|
LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(option_id_closure).flatten().collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: called `map(..).flatten()` on an `Iterator`
--> $DIR/map_flatten.rs:16:46
|
LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(option_id_closure).flatten().collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using `filter_map` instead: `.filter_map(option_id_closure)`
error: non-binding let on a type that implements `Drop`
--> $DIR/map_flatten.rs:17:5
|
LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(|x| x.checked_add(1)).flatten().collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: called `map(..).flatten()` on an `Iterator`
--> $DIR/map_flatten.rs:17:46
|
LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(|x| x.checked_add(1)).flatten().collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using `filter_map` instead: `.filter_map(|x| x.checked_add(1))`
error: non-binding let on a type that implements `Drop`
--> $DIR/map_flatten.rs:20:5
|
LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(|x| 0..x).flatten().collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: called `map(..).flatten()` on an `Iterator`
--> $DIR/map_flatten.rs:20:46
|
@ -36,5 +77,5 @@ error: called `map(..).flatten()` on an `Option`
LL | let _: Option<_> = (Some(Some(1))).map(|x| x).flatten();
| ^^^^^^^^^^^^^^^^^^^^^ help: try using `and_then` instead: `.and_then(|x| x)`
error: aborting due to 6 previous errors
error: aborting due to 11 previous errors

View File

@ -1,3 +1,12 @@
error: non-binding let on a type that implements `Drop`
--> $DIR/map_identity.rs:8:5
|
LL | let _: Vec<_> = x.iter().map(not_identity).map(|x| return x).collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[deny(clippy::let_underscore_drop)]` on by default
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: unnecessary map of the identity function
--> $DIR/map_identity.rs:8:47
|
@ -6,6 +15,14 @@ LL | let _: Vec<_> = x.iter().map(not_identity).map(|x| return x).collect();
|
= note: `-D clippy::map-identity` implied by `-D warnings`
error: non-binding let on a type that implements `Drop`
--> $DIR/map_identity.rs:9:5
|
LL | let _: Vec<_> = x.iter().map(std::convert::identity).map(|y| y).collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: unnecessary map of the identity function
--> $DIR/map_identity.rs:9:57
|
@ -33,5 +50,21 @@ LL | | return x;
LL | | });
| |______^ help: remove the call to `map`
error: aborting due to 5 previous errors
error: non-binding let on a type that implements `Drop`
--> $DIR/map_identity.rs:15:5
|
LL | let _: Vec<_> = x.iter().map(|x| 2 * x).collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: non-binding let on a type that implements `Drop`
--> $DIR/map_identity.rs:16:5
|
LL | let _: Vec<_> = x.iter().map(not_identity).map(|x| return x - 4).collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: aborting due to 9 previous errors

View File

@ -150,6 +150,20 @@ LL | let Point { x, y } = coords();
LL | let product = x * y;
|
error: non-binding let on a type that implements `Drop`
--> $DIR/match_single_binding.rs:96:5
|
LL | / let _ = v
LL | | .iter()
LL | | .map(|i| match i.unwrap() {
LL | | unwrapped => unwrapped,
LL | | })
LL | | .collect::<Vec<u8>>();
| |______________________________^
|
= note: `#[deny(clippy::let_underscore_drop)]` on by default
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: this match could be written as a `let` statement
--> $DIR/match_single_binding.rs:98:18
|
@ -167,5 +181,5 @@ LL | unwrapped
LL | })
|
error: aborting due to 11 previous errors
error: aborting due to 12 previous errors

View File

@ -90,6 +90,15 @@ help: change `v.clone()` to
LL | let _ = v.to_owned();
| ^^^^^^^^^^^^
error: non-binding let on a type that implements `Drop`
--> $DIR/needless_pass_by_value.rs:85:5
|
LL | let _ = v.clone();
| ^^^^^^^^^^^^^^^^^^
|
= note: `#[deny(clippy::let_underscore_drop)]` on by default
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:94:12
|
@ -174,5 +183,5 @@ error: this argument is passed by value, but not consumed in the function body
LL | fn more_fun(_item: impl Club<'static, i32>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^ help: consider taking a reference instead: `&impl Club<'static, i32>`
error: aborting due to 22 previous errors
error: aborting due to 23 previous errors

View File

@ -167,5 +167,14 @@ note: cloned value is neither consumed nor mutated
LL | let y = x.clone().join("matthias");
| ^^^^^^^^^
error: aborting due to 14 previous errors
error: non-binding let on a type that implements `Drop`
--> $DIR/redundant_clone.rs:180:5
|
LL | let _ = a.clone(); // OK
| ^^^^^^^^^^^^^^^^^^
|
= note: `#[deny(clippy::let_underscore_drop)]` on by default
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: aborting due to 15 previous errors

View File

@ -10,6 +10,15 @@ help: consider using the following if you are attempting to iterate over this ra
LL | (21..=42).rev().for_each(|x| println!("{}", x));
| ^^^^^^^^^^^^^^^
error: non-binding let on a type that implements `Drop`
--> $DIR/reversed_empty_ranges_fixable.rs:10:5
|
LL | let _ = (ANSWER..21).filter(|x| x % 2 == 0).take(10).collect::<Vec<_>>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[deny(clippy::let_underscore_drop)]` on by default
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: this range is empty so it will yield no values
--> $DIR/reversed_empty_ranges_fixable.rs:10:13
|
@ -43,5 +52,5 @@ help: consider using the following if you are attempting to iterate over this ra
LL | for _ in (21u32..42u32).rev() {}
| ^^^^^^^^^^^^^^^^^^^^
error: aborting due to 4 previous errors
error: aborting due to 5 previous errors

View File

@ -24,30 +24,71 @@ error: transmute from a reference to a pointer
LL | let _: *const U = core::intrinsics::transmute(t);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `t as *const T as *const U`
error: non-binding let on a type that implements `Drop`
--> $DIR/transmute.rs:34:9
|
LL | let _: Vec<i32> = core::intrinsics::transmute(my_vec());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[deny(clippy::let_underscore_drop)]` on by default
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: transmute from a type (`std::vec::Vec<i32>`) to itself
--> $DIR/transmute.rs:34:27
|
LL | let _: Vec<i32> = core::intrinsics::transmute(my_vec());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: non-binding let on a type that implements `Drop`
--> $DIR/transmute.rs:36:9
|
LL | let _: Vec<i32> = core::mem::transmute(my_vec());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: transmute from a type (`std::vec::Vec<i32>`) to itself
--> $DIR/transmute.rs:36:27
|
LL | let _: Vec<i32> = core::mem::transmute(my_vec());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: non-binding let on a type that implements `Drop`
--> $DIR/transmute.rs:38:9
|
LL | let _: Vec<i32> = std::intrinsics::transmute(my_vec());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: transmute from a type (`std::vec::Vec<i32>`) to itself
--> $DIR/transmute.rs:38:27
|
LL | let _: Vec<i32> = std::intrinsics::transmute(my_vec());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: non-binding let on a type that implements `Drop`
--> $DIR/transmute.rs:40:9
|
LL | let _: Vec<i32> = std::mem::transmute(my_vec());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: transmute from a type (`std::vec::Vec<i32>`) to itself
--> $DIR/transmute.rs:40:27
|
LL | let _: Vec<i32> = std::mem::transmute(my_vec());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: non-binding let on a type that implements `Drop`
--> $DIR/transmute.rs:42:9
|
LL | let _: Vec<i32> = my_transmute(my_vec());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: transmute from a type (`std::vec::Vec<i32>`) to itself
--> $DIR/transmute.rs:42:27
|
@ -154,5 +195,5 @@ error: transmute from a `&mut [u8]` to a `&mut str`
LL | let _: &mut str = unsafe { std::mem::transmute(mb) };
| ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::str::from_utf8_mut(mb).unwrap()`
error: aborting due to 24 previous errors
error: aborting due to 29 previous errors

View File

@ -1,3 +1,12 @@
error: non-binding let on a type that implements `Drop`
--> $DIR/transmute_collection.rs:9:9
|
LL | let _ = transmute::<_, Vec<u32>>(vec![0u8]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[deny(clippy::let_underscore_drop)]` on by default
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: transmute from `std::vec::Vec<u8>` to `std::vec::Vec<u32>` with mismatched layout is unsound
--> $DIR/transmute_collection.rs:9:17
|
@ -6,18 +15,42 @@ LL | let _ = transmute::<_, Vec<u32>>(vec![0u8]);
|
= note: `-D clippy::unsound-collection-transmute` implied by `-D warnings`
error: non-binding let on a type that implements `Drop`
--> $DIR/transmute_collection.rs:11:9
|
LL | let _ = transmute::<_, Vec<[u8; 4]>>(vec![1234u32]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: transmute from `std::vec::Vec<u32>` to `std::vec::Vec<[u8; 4]>` with mismatched layout is unsound
--> $DIR/transmute_collection.rs:11:17
|
LL | let _ = transmute::<_, Vec<[u8; 4]>>(vec![1234u32]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: non-binding let on a type that implements `Drop`
--> $DIR/transmute_collection.rs:14:9
|
LL | let _ = transmute::<_, VecDeque<u32>>(VecDeque::<u8>::new());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: transmute from `std::collections::VecDeque<u8>` to `std::collections::VecDeque<u32>` with mismatched layout is unsound
--> $DIR/transmute_collection.rs:14:17
|
LL | let _ = transmute::<_, VecDeque<u32>>(VecDeque::<u8>::new());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: non-binding let on a type that implements `Drop`
--> $DIR/transmute_collection.rs:16:9
|
LL | let _ = transmute::<_, VecDeque<u32>>(VecDeque::<[u8; 4]>::new());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: transmute from `std::collections::VecDeque<[u8; 4]>` to `std::collections::VecDeque<u32>` with mismatched layout is unsound
--> $DIR/transmute_collection.rs:16:17
|
@ -60,24 +93,56 @@ error: transmute from `std::collections::HashSet<[u8; 4]>` to `std::collections:
LL | let _ = transmute::<_, HashSet<u32>>(HashSet::<[u8; 4]>::new());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: non-binding let on a type that implements `Drop`
--> $DIR/transmute_collection.rs:34:9
|
LL | let _ = transmute::<_, BTreeMap<u8, u32>>(BTreeMap::<u8, u8>::new());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: transmute from `std::collections::BTreeMap<u8, u8>` to `std::collections::BTreeMap<u8, u32>` with mismatched layout is unsound
--> $DIR/transmute_collection.rs:34:17
|
LL | let _ = transmute::<_, BTreeMap<u8, u32>>(BTreeMap::<u8, u8>::new());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: non-binding let on a type that implements `Drop`
--> $DIR/transmute_collection.rs:35:9
|
LL | let _ = transmute::<_, BTreeMap<u8, u32>>(BTreeMap::<u32, u32>::new());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: transmute from `std::collections::BTreeMap<u32, u32>` to `std::collections::BTreeMap<u8, u32>` with mismatched layout is unsound
--> $DIR/transmute_collection.rs:35:17
|
LL | let _ = transmute::<_, BTreeMap<u8, u32>>(BTreeMap::<u32, u32>::new());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: non-binding let on a type that implements `Drop`
--> $DIR/transmute_collection.rs:37:9
|
LL | let _ = transmute::<_, BTreeMap<u8, u32>>(BTreeMap::<u8, [u8; 4]>::new());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: transmute from `std::collections::BTreeMap<u8, [u8; 4]>` to `std::collections::BTreeMap<u8, u32>` with mismatched layout is unsound
--> $DIR/transmute_collection.rs:37:17
|
LL | let _ = transmute::<_, BTreeMap<u8, u32>>(BTreeMap::<u8, [u8; 4]>::new());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: non-binding let on a type that implements `Drop`
--> $DIR/transmute_collection.rs:38:9
|
LL | let _ = transmute::<_, BTreeMap<u32, u32>>(BTreeMap::<[u8; 4], u32>::new());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: transmute from `std::collections::BTreeMap<[u8; 4], u32>` to `std::collections::BTreeMap<u32, u32>` with mismatched layout is unsound
--> $DIR/transmute_collection.rs:38:17
|
@ -108,5 +173,5 @@ error: transmute from `std::collections::HashMap<[u8; 4], u32>` to `std::collect
LL | let _ = transmute::<_, HashMap<u32, u32>>(HashMap::<[u8; 4], u32>::new());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 18 previous errors
error: aborting due to 26 previous errors

View File

@ -24,6 +24,15 @@ error: using `.clone()` on a ref-counted pointer
LL | arc_weak.clone();
| ^^^^^^^^^^^^^^^^ help: try this: `Weak::<bool>::clone(&arc_weak)`
error: non-binding let on a type that implements `Drop`
--> $DIR/unnecessary_clone.rs:36:5
|
LL | let _: Arc<dyn SomeTrait> = x.clone();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[deny(clippy::let_underscore_drop)]` on by default
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: using `.clone()` on a ref-counted pointer
--> $DIR/unnecessary_clone.rs:36:33
|
@ -102,5 +111,5 @@ error: using `.clone()` on a ref-counted pointer
LL | Some(try_opt!(Some(rc)).clone())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `Rc::<u8>::clone(&try_opt!(Some(rc)))`
error: aborting due to 12 previous errors
error: aborting due to 13 previous errors

View File

@ -52,6 +52,15 @@ error: useless conversion to the same type: `std::str::Lines`
LL | let _ = "".lines().into_iter();
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `"".lines()`
error: non-binding let on a type that implements `Drop`
--> $DIR/useless_conversion.rs:65:5
|
LL | let _ = vec![1, 2, 3].into_iter().into_iter();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[deny(clippy::let_underscore_drop)]` on by default
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
error: useless conversion to the same type: `std::vec::IntoIter<i32>`
--> $DIR/useless_conversion.rs:65:13
|
@ -70,5 +79,5 @@ error: useless conversion to the same type: `i32`
LL | let _ = i32::from(a + b) * 3;
| ^^^^^^^^^^^^^^^^ help: consider removing `i32::from()`: `(a + b)`
error: aborting due to 11 previous errors
error: aborting due to 12 previous errors