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.
This commit is contained in:
Aaron Kofsky 2022-06-03 16:19:55 -04:00
parent 36b6309c65
commit ae2ac3b4c5
5 changed files with 9 additions and 7 deletions

View File

@ -41,7 +41,7 @@
/// calling `std::mem::drop` on the expression is clearer and helps convey /// calling `std::mem::drop` on the expression is clearer and helps convey
/// intent. /// intent.
pub LET_UNDERSCORE_DROP, pub LET_UNDERSCORE_DROP,
Warn, Allow,
"non-binding let on a type that implements `Drop`" "non-binding let on a type that implements `Drop`"
} }
@ -104,7 +104,7 @@
/// expression to immediately drop. Usually, it's better to explicitly handle /// expression to immediately drop. Usually, it's better to explicitly handle
/// the `must_use` expression. /// the `must_use` expression.
pub LET_UNDERSCORE_MUST_USE, pub LET_UNDERSCORE_MUST_USE,
Warn, Allow,
"non-binding let on a expression marked `must_use`" "non-binding let on a expression marked `must_use`"
} }

View File

@ -1,4 +1,5 @@
// run-pass // run-pass
// compile-flags: -W let_underscore_drop
struct NontrivialDrop; struct NontrivialDrop;

View File

@ -1,10 +1,10 @@
warning: non-binding let on a type that implements `Drop` 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; 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 binding to an unused variable
= help: consider explicitly droping with `std::mem::drop` = help: consider explicitly droping with `std::mem::drop`

View File

@ -1,4 +1,5 @@
// run-pass // run-pass
// compile-flags: -W let_underscore_must_use
#[must_use] #[must_use]
struct MustUseType; struct MustUseType;

View File

@ -1,15 +1,15 @@
warning: non-binding let on a expression marked `must_use` 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; 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 binding to an unused variable
= help: consider explicitly droping with `std::mem::drop` = help: consider explicitly droping with `std::mem::drop`
warning: non-binding let on a expression marked `must_use` 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(); LL | let _ = must_use_function();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^