]> git.lizzy.rs Git - rust.git/commitdiff
Allow `let_underscore_drop` and `let_underscore_must_use` by default.
authorAaron Kofsky <aaronko@umich.edu>
Fri, 3 Jun 2022 20:19:55 +0000 (16:19 -0400)
committerAaron Kofsky <aaronko@umich.edu>
Sat, 4 Jun 2022 19:35:11 +0000 (15:35 -0400)
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
src/test/ui/let_underscore/let_underscore_drop.rs
src/test/ui/let_underscore/let_underscore_drop.stderr
src/test/ui/let_underscore/let_underscore_must_use.rs
src/test/ui/let_underscore/let_underscore_must_use.stderr

index 40e6d12abf91066771f978d56ab647bfdf77ff28..985c7300efa95e4da4bd4befada1337005d30dd7 100644 (file)
@@ -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`"
 }
 
     /// 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`"
 }
 
index c1c5207d0fe87c67c8214494a5723e0089111210..75c6ecec3ee537b1f907324441699a35c5bd6435 100644 (file)
@@ -1,4 +1,5 @@
 // run-pass
+// compile-flags: -W let_underscore_drop
 
 struct NontrivialDrop;
 
index 40ed1abd8dc6fffefec17bed708305ae524fabc5..f4fd663c7f9ea980dac99fe8b98890056f952dd0 100644 (file)
@@ -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`
 
index 6a78e3fc4b402402938d3fc65631bc2e838331b1..8efaad51ea87788ecf80e891441fb06c15a5d39f 100644 (file)
@@ -1,4 +1,5 @@
 // run-pass
+// compile-flags: -W let_underscore_must_use
 
 #[must_use]
 struct MustUseType;
index 0b840385e5dfa7c3ea11ba1be53b45af20b50166..ea1de45e17b5759250674fbb28f4dd0085d2370e 100644 (file)
@@ -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();
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^