Set let_underscore_lock to Deny by default.

Clippy sets this lint to Deny by default, and it having the lint be Deny
is useful for when we test the lint against a Crater run.
This commit is contained in:
Aaron Kofsky 2022-06-04 13:50:12 -04:00
parent eba6c789dc
commit 6b179e3a67
3 changed files with 7 additions and 9 deletions

View File

@ -55,7 +55,7 @@
/// of at end of scope, which is typically incorrect.
///
/// ### Example
/// ```rust
/// ```compile_fail
/// use std::sync::{Arc, Mutex};
/// use std::thread;
/// let data = Arc::new(Mutex::new(0));
@ -83,7 +83,7 @@
/// calling `std::mem::drop` on the expression is clearer and helps convey
/// intent.
pub LET_UNDERSCORE_LOCK,
Warn,
Deny,
"non-binding let on a synchronization lock"
}

View File

@ -1,8 +1,6 @@
// run-pass
use std::sync::{Arc, Mutex};
fn main() {
let data = Arc::new(Mutex::new(0));
let _ = data.lock().unwrap(); //~WARNING non-binding let on a synchronization lock
let _ = data.lock().unwrap(); //~ERROR non-binding let on a synchronization lock
}

View File

@ -1,10 +1,10 @@
warning: non-binding let on a synchronization lock
--> $DIR/let_underscore_lock.rs:7:5
error: non-binding let on a synchronization lock
--> $DIR/let_underscore_lock.rs:5:5
|
LL | let _ = data.lock().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(let_underscore_lock)]` on by default
= note: `#[deny(let_underscore_lock)]` on by default
help: consider binding to an unused variable
|
LL | let _unused = data.lock().unwrap();
@ -14,5 +14,5 @@ help: consider explicitly droping with `std::mem::drop`
LL | let _ = drop(...);
| ~~~~~~~~~
warning: 1 warning emitted
error: aborting due to previous error