Skip to content

Commit 6b179e3

Browse files
committed
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.
1 parent eba6c78 commit 6b179e3

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

compiler/rustc_lint/src/let_underscore.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ declare_lint! {
5555
/// of at end of scope, which is typically incorrect.
5656
///
5757
/// ### Example
58-
/// ```rust
58+
/// ```compile_fail
5959
/// use std::sync::{Arc, Mutex};
6060
/// use std::thread;
6161
/// let data = Arc::new(Mutex::new(0));
@@ -83,7 +83,7 @@ declare_lint! {
8383
/// calling `std::mem::drop` on the expression is clearer and helps convey
8484
/// intent.
8585
pub LET_UNDERSCORE_LOCK,
86-
Warn,
86+
Deny,
8787
"non-binding let on a synchronization lock"
8888
}
8989

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
// run-pass
2-
31
use std::sync::{Arc, Mutex};
42

53
fn main() {
64
let data = Arc::new(Mutex::new(0));
7-
let _ = data.lock().unwrap(); //~WARNING non-binding let on a synchronization lock
5+
let _ = data.lock().unwrap(); //~ERROR non-binding let on a synchronization lock
86
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
warning: non-binding let on a synchronization lock
2-
--> $DIR/let_underscore_lock.rs:7:5
1+
error: non-binding let on a synchronization lock
2+
--> $DIR/let_underscore_lock.rs:5:5
33
|
44
LL | let _ = data.lock().unwrap();
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
7-
= note: `#[warn(let_underscore_lock)]` on by default
7+
= note: `#[deny(let_underscore_lock)]` on by default
88
help: consider binding to an unused variable
99
|
1010
LL | let _unused = data.lock().unwrap();
@@ -14,5 +14,5 @@ help: consider explicitly droping with `std::mem::drop`
1414
LL | let _ = drop(...);
1515
| ~~~~~~~~~
1616

17-
warning: 1 warning emitted
17+
error: aborting due to previous error
1818

0 commit comments

Comments
 (0)