From 6b179e3a67a2242b63892a1831ba217d968c2f62 Mon Sep 17 00:00:00 2001 From: Aaron Kofsky Date: Sat, 4 Jun 2022 13:50:12 -0400 Subject: [PATCH] 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. --- compiler/rustc_lint/src/let_underscore.rs | 4 ++-- src/test/ui/let_underscore/let_underscore_lock.rs | 4 +--- src/test/ui/let_underscore/let_underscore_lock.stderr | 8 ++++---- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/compiler/rustc_lint/src/let_underscore.rs b/compiler/rustc_lint/src/let_underscore.rs index 4e4cedaeb78..306c6197c24 100644 --- a/compiler/rustc_lint/src/let_underscore.rs +++ b/compiler/rustc_lint/src/let_underscore.rs @@ -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" } diff --git a/src/test/ui/let_underscore/let_underscore_lock.rs b/src/test/ui/let_underscore/let_underscore_lock.rs index 774b610db2f..c37264136ef 100644 --- a/src/test/ui/let_underscore/let_underscore_lock.rs +++ b/src/test/ui/let_underscore/let_underscore_lock.rs @@ -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 } diff --git a/src/test/ui/let_underscore/let_underscore_lock.stderr b/src/test/ui/let_underscore/let_underscore_lock.stderr index 08f81962f3c..b7e14e8c7b5 100644 --- a/src/test/ui/let_underscore/let_underscore_lock.stderr +++ b/src/test/ui/let_underscore/let_underscore_lock.stderr @@ -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