]> git.lizzy.rs Git - rust.git/commitdiff
Move `let_underscore` tests into the `lint` subfolder.
authorAaron Kofsky <aaronko@umich.edu>
Sun, 5 Jun 2022 00:04:01 +0000 (20:04 -0400)
committerAaron Kofsky <aaronko@umich.edu>
Sun, 5 Jun 2022 00:04:01 +0000 (20:04 -0400)
12 files changed:
src/test/ui/let_underscore/let_underscore_drop.rs [deleted file]
src/test/ui/let_underscore/let_underscore_drop.stderr [deleted file]
src/test/ui/let_underscore/let_underscore_lock.rs [deleted file]
src/test/ui/let_underscore/let_underscore_lock.stderr [deleted file]
src/test/ui/let_underscore/let_underscore_must_use.rs [deleted file]
src/test/ui/let_underscore/let_underscore_must_use.stderr [deleted file]
src/test/ui/lint/let_underscore/let_underscore_drop.rs [new file with mode: 0644]
src/test/ui/lint/let_underscore/let_underscore_drop.stderr [new file with mode: 0644]
src/test/ui/lint/let_underscore/let_underscore_lock.rs [new file with mode: 0644]
src/test/ui/lint/let_underscore/let_underscore_lock.stderr [new file with mode: 0644]
src/test/ui/lint/let_underscore/let_underscore_must_use.rs [new file with mode: 0644]
src/test/ui/lint/let_underscore/let_underscore_must_use.stderr [new file with mode: 0644]

diff --git a/src/test/ui/let_underscore/let_underscore_drop.rs b/src/test/ui/let_underscore/let_underscore_drop.rs
deleted file mode 100644 (file)
index 75c6ece..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// run-pass
-// compile-flags: -W let_underscore_drop
-
-struct NontrivialDrop;
-
-impl Drop for NontrivialDrop {
-    fn drop(&mut self) {
-        println!("Dropping!");
-    }
-}
-
-fn main() {
-    let _ = NontrivialDrop; //~WARNING non-binding let on a type that implements `Drop`
-}
diff --git a/src/test/ui/let_underscore/let_underscore_drop.stderr b/src/test/ui/let_underscore/let_underscore_drop.stderr
deleted file mode 100644 (file)
index 5034f68..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-warning: non-binding let on a type that implements `Drop`
-  --> $DIR/let_underscore_drop.rs:13:5
-   |
-LL |     let _ = NontrivialDrop;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: requested on the command line with `-W let-underscore-drop`
-help: consider binding to an unused variable
-   |
-LL |     let _unused = NontrivialDrop;
-   |         ~~~~~~~
-help: consider explicitly droping with `std::mem::drop`
-   |
-LL |     let _ = drop(...);
-   |             ~~~~~~~~~
-
-warning: 1 warning emitted
-
diff --git a/src/test/ui/let_underscore/let_underscore_lock.rs b/src/test/ui/let_underscore/let_underscore_lock.rs
deleted file mode 100644 (file)
index c372641..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-use std::sync::{Arc, Mutex};
-
-fn main() {
-    let data = Arc::new(Mutex::new(0));
-    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
deleted file mode 100644 (file)
index b7e14e8..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-error: non-binding let on a synchronization lock
-  --> $DIR/let_underscore_lock.rs:5:5
-   |
-LL |     let _ = data.lock().unwrap();
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: `#[deny(let_underscore_lock)]` on by default
-help: consider binding to an unused variable
-   |
-LL |     let _unused = data.lock().unwrap();
-   |         ~~~~~~~
-help: consider explicitly droping with `std::mem::drop`
-   |
-LL |     let _ = drop(...);
-   |             ~~~~~~~~~
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/let_underscore/let_underscore_must_use.rs b/src/test/ui/let_underscore/let_underscore_must_use.rs
deleted file mode 100644 (file)
index 8efaad5..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-// run-pass
-// compile-flags: -W let_underscore_must_use
-
-#[must_use]
-struct MustUseType;
-
-#[must_use]
-fn must_use_function() -> () {}
-
-fn main() {
-    let _ = MustUseType; //~WARNING non-binding let on a expression marked `must_use`
-    let _ = must_use_function(); //~WARNING non-binding let on a expression marked `must_use`
-}
diff --git a/src/test/ui/let_underscore/let_underscore_must_use.stderr b/src/test/ui/let_underscore/let_underscore_must_use.stderr
deleted file mode 100644 (file)
index 959572e..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-warning: non-binding let on a expression marked `must_use`
-  --> $DIR/let_underscore_must_use.rs:11:5
-   |
-LL |     let _ = MustUseType;
-   |     ^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: requested on the command line with `-W let-underscore-must-use`
-help: consider binding to an unused variable
-   |
-LL |     let _unused = MustUseType;
-   |         ~~~~~~~
-help: consider explicitly droping with `std::mem::drop`
-   |
-LL |     let _ = drop(...);
-   |             ~~~~~~~~~
-
-warning: non-binding let on a expression marked `must_use`
-  --> $DIR/let_underscore_must_use.rs:12:5
-   |
-LL |     let _ = must_use_function();
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-help: consider binding to an unused variable
-   |
-LL |     let _unused = must_use_function();
-   |         ~~~~~~~
-help: consider explicitly droping with `std::mem::drop`
-   |
-LL |     let _ = drop(...);
-   |             ~~~~~~~~~
-
-warning: 2 warnings emitted
-
diff --git a/src/test/ui/lint/let_underscore/let_underscore_drop.rs b/src/test/ui/lint/let_underscore/let_underscore_drop.rs
new file mode 100644 (file)
index 0000000..75c6ece
--- /dev/null
@@ -0,0 +1,14 @@
+// run-pass
+// compile-flags: -W let_underscore_drop
+
+struct NontrivialDrop;
+
+impl Drop for NontrivialDrop {
+    fn drop(&mut self) {
+        println!("Dropping!");
+    }
+}
+
+fn main() {
+    let _ = NontrivialDrop; //~WARNING non-binding let on a type that implements `Drop`
+}
diff --git a/src/test/ui/lint/let_underscore/let_underscore_drop.stderr b/src/test/ui/lint/let_underscore/let_underscore_drop.stderr
new file mode 100644 (file)
index 0000000..5034f68
--- /dev/null
@@ -0,0 +1,18 @@
+warning: non-binding let on a type that implements `Drop`
+  --> $DIR/let_underscore_drop.rs:13:5
+   |
+LL |     let _ = NontrivialDrop;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: requested on the command line with `-W let-underscore-drop`
+help: consider binding to an unused variable
+   |
+LL |     let _unused = NontrivialDrop;
+   |         ~~~~~~~
+help: consider explicitly droping with `std::mem::drop`
+   |
+LL |     let _ = drop(...);
+   |             ~~~~~~~~~
+
+warning: 1 warning emitted
+
diff --git a/src/test/ui/lint/let_underscore/let_underscore_lock.rs b/src/test/ui/lint/let_underscore/let_underscore_lock.rs
new file mode 100644 (file)
index 0000000..c372641
--- /dev/null
@@ -0,0 +1,6 @@
+use std::sync::{Arc, Mutex};
+
+fn main() {
+    let data = Arc::new(Mutex::new(0));
+    let _ = data.lock().unwrap(); //~ERROR non-binding let on a synchronization lock
+}
diff --git a/src/test/ui/lint/let_underscore/let_underscore_lock.stderr b/src/test/ui/lint/let_underscore/let_underscore_lock.stderr
new file mode 100644 (file)
index 0000000..b7e14e8
--- /dev/null
@@ -0,0 +1,18 @@
+error: non-binding let on a synchronization lock
+  --> $DIR/let_underscore_lock.rs:5:5
+   |
+LL |     let _ = data.lock().unwrap();
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `#[deny(let_underscore_lock)]` on by default
+help: consider binding to an unused variable
+   |
+LL |     let _unused = data.lock().unwrap();
+   |         ~~~~~~~
+help: consider explicitly droping with `std::mem::drop`
+   |
+LL |     let _ = drop(...);
+   |             ~~~~~~~~~
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lint/let_underscore/let_underscore_must_use.rs b/src/test/ui/lint/let_underscore/let_underscore_must_use.rs
new file mode 100644 (file)
index 0000000..8efaad5
--- /dev/null
@@ -0,0 +1,13 @@
+// run-pass
+// compile-flags: -W let_underscore_must_use
+
+#[must_use]
+struct MustUseType;
+
+#[must_use]
+fn must_use_function() -> () {}
+
+fn main() {
+    let _ = MustUseType; //~WARNING non-binding let on a expression marked `must_use`
+    let _ = must_use_function(); //~WARNING non-binding let on a expression marked `must_use`
+}
diff --git a/src/test/ui/lint/let_underscore/let_underscore_must_use.stderr b/src/test/ui/lint/let_underscore/let_underscore_must_use.stderr
new file mode 100644 (file)
index 0000000..959572e
--- /dev/null
@@ -0,0 +1,33 @@
+warning: non-binding let on a expression marked `must_use`
+  --> $DIR/let_underscore_must_use.rs:11:5
+   |
+LL |     let _ = MustUseType;
+   |     ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: requested on the command line with `-W let-underscore-must-use`
+help: consider binding to an unused variable
+   |
+LL |     let _unused = MustUseType;
+   |         ~~~~~~~
+help: consider explicitly droping with `std::mem::drop`
+   |
+LL |     let _ = drop(...);
+   |             ~~~~~~~~~
+
+warning: non-binding let on a expression marked `must_use`
+  --> $DIR/let_underscore_must_use.rs:12:5
+   |
+LL |     let _ = must_use_function();
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+help: consider binding to an unused variable
+   |
+LL |     let _unused = must_use_function();
+   |         ~~~~~~~
+help: consider explicitly droping with `std::mem::drop`
+   |
+LL |     let _ = drop(...);
+   |             ~~~~~~~~~
+
+warning: 2 warnings emitted
+