From ae2ac3b4c568d2d20cb395a57a163e1e298d6d6c Mon Sep 17 00:00:00 2001 From: Aaron Kofsky Date: Fri, 3 Jun 2022 16:19:55 -0400 Subject: [PATCH] Allow `let_underscore_drop` and `let_underscore_must_use` by default. These lints are very noisy and are allow-by-default in clippy anyways. Hence, setting them to allow-by-default here makes more sense than warning constantly on these cases. --- compiler/rustc_lint/src/let_underscore.rs | 4 ++-- src/test/ui/let_underscore/let_underscore_drop.rs | 1 + src/test/ui/let_underscore/let_underscore_drop.stderr | 4 ++-- src/test/ui/let_underscore/let_underscore_must_use.rs | 1 + src/test/ui/let_underscore/let_underscore_must_use.stderr | 6 +++--- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/compiler/rustc_lint/src/let_underscore.rs b/compiler/rustc_lint/src/let_underscore.rs index 40e6d12abf9..985c7300efa 100644 --- a/compiler/rustc_lint/src/let_underscore.rs +++ b/compiler/rustc_lint/src/let_underscore.rs @@ -41,7 +41,7 @@ /// calling `std::mem::drop` on the expression is clearer and helps convey /// intent. pub LET_UNDERSCORE_DROP, - Warn, + Allow, "non-binding let on a type that implements `Drop`" } @@ -104,7 +104,7 @@ /// expression to immediately drop. Usually, it's better to explicitly handle /// the `must_use` expression. pub LET_UNDERSCORE_MUST_USE, - Warn, + Allow, "non-binding let on a expression marked `must_use`" } diff --git a/src/test/ui/let_underscore/let_underscore_drop.rs b/src/test/ui/let_underscore/let_underscore_drop.rs index c1c5207d0fe..75c6ecec3ee 100644 --- a/src/test/ui/let_underscore/let_underscore_drop.rs +++ b/src/test/ui/let_underscore/let_underscore_drop.rs @@ -1,4 +1,5 @@ // run-pass +// compile-flags: -W let_underscore_drop struct NontrivialDrop; diff --git a/src/test/ui/let_underscore/let_underscore_drop.stderr b/src/test/ui/let_underscore/let_underscore_drop.stderr index 40ed1abd8dc..f4fd663c7f9 100644 --- a/src/test/ui/let_underscore/let_underscore_drop.stderr +++ b/src/test/ui/let_underscore/let_underscore_drop.stderr @@ -1,10 +1,10 @@ warning: non-binding let on a type that implements `Drop` - --> $DIR/let_underscore_drop.rs:12:5 + --> $DIR/let_underscore_drop.rs:13:5 | LL | let _ = NontrivialDrop; | ^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `#[warn(let_underscore_drop)]` on by default + = note: requested on the command line with `-W let-underscore-drop` = help: consider binding to an unused variable = help: consider explicitly droping with `std::mem::drop` diff --git a/src/test/ui/let_underscore/let_underscore_must_use.rs b/src/test/ui/let_underscore/let_underscore_must_use.rs index 6a78e3fc4b4..8efaad51ea8 100644 --- a/src/test/ui/let_underscore/let_underscore_must_use.rs +++ b/src/test/ui/let_underscore/let_underscore_must_use.rs @@ -1,4 +1,5 @@ // run-pass +// compile-flags: -W let_underscore_must_use #[must_use] struct MustUseType; diff --git a/src/test/ui/let_underscore/let_underscore_must_use.stderr b/src/test/ui/let_underscore/let_underscore_must_use.stderr index 0b840385e5d..ea1de45e17b 100644 --- a/src/test/ui/let_underscore/let_underscore_must_use.stderr +++ b/src/test/ui/let_underscore/let_underscore_must_use.stderr @@ -1,15 +1,15 @@ warning: non-binding let on a expression marked `must_use` - --> $DIR/let_underscore_must_use.rs:10:5 + --> $DIR/let_underscore_must_use.rs:11:5 | LL | let _ = MustUseType; | ^^^^^^^^^^^^^^^^^^^^ | - = note: `#[warn(let_underscore_must_use)]` on by default + = note: requested on the command line with `-W let-underscore-must-use` = help: consider binding to an unused variable = help: consider explicitly droping with `std::mem::drop` warning: non-binding let on a expression marked `must_use` - --> $DIR/let_underscore_must_use.rs:11:5 + --> $DIR/let_underscore_must_use.rs:12:5 | LL | let _ = must_use_function(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^