Skip to content

Commit

Permalink
Set let_underscore_lock to Deny by default.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
a2aaron committed Jun 4, 2022
1 parent eba6c78 commit 6b179e3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_lint/src/let_underscore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ declare_lint! {
/// 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));
Expand Down Expand Up @@ -83,7 +83,7 @@ declare_lint! {
/// 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"
}

Expand Down
4 changes: 1 addition & 3 deletions src/test/ui/let_underscore/let_underscore_lock.rs
Original file line number Diff line number Diff line change
@@ -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
}
8 changes: 4 additions & 4 deletions src/test/ui/let_underscore/let_underscore_lock.stderr
Original file line number Diff line number Diff line change
@@ -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();
Expand All @@ -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

0 comments on commit 6b179e3

Please sign in to comment.