about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorUrgau <urgau@numericable.fr>2023-04-14 22:20:27 +0200
committerUrgau <urgau@numericable.fr>2023-05-10 19:36:02 +0200
commite280df556dbbe4d25c3a7f29f6e7fee44c543e0b (patch)
tree5141b2752f1901100ebf50fdebae60c5dec7a2b0 /tests
parentd23f8957ae9f6a2e3121529422e7883d8bdbcc14 (diff)
downloadrust-e280df556dbbe4d25c3a7f29f6e7fee44c543e0b.tar.gz
rust-e280df556dbbe4d25c3a7f29f6e7fee44c543e0b.zip
Add note to suggest using `let _ = x` to ignore the value
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/lint/drop_copy.stderr18
-rw-r--r--tests/ui/lint/drop_ref.stderr23
-rw-r--r--tests/ui/lint/forget_copy.stderr14
-rw-r--r--tests/ui/lint/forget_ref.stderr17
4 files changed, 72 insertions, 0 deletions
diff --git a/tests/ui/lint/drop_copy.stderr b/tests/ui/lint/drop_copy.stderr
index 2f122ad2aaa..db8e89ad295 100644
--- a/tests/ui/lint/drop_copy.stderr
+++ b/tests/ui/lint/drop_copy.stderr
@@ -6,6 +6,7 @@ LL |     drop(s1);
    |          |
    |          argument has type `SomeStruct`
    |
+   = note: use `let _ = ...` to ignore the expression or result
 note: the lint level is defined here
   --> $DIR/drop_copy.rs:3:9
    |
@@ -19,6 +20,8 @@ LL |     drop(s2);
    |     ^^^^^--^
    |          |
    |          argument has type `SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
 
 warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
   --> $DIR/drop_copy.rs:36:5
@@ -28,6 +31,7 @@ LL |     drop(s3);
    |          |
    |          argument has type `&SomeStruct`
    |
+   = note: use `let _ = ...` to ignore the expression or result
    = note: `#[warn(drop_ref)]` on by default
 
 warning: calls to `std::mem::drop` with a value that implements `Copy` does nothing
@@ -37,6 +41,8 @@ LL |     drop(s4);
    |     ^^^^^--^
    |          |
    |          argument has type `SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
 
 warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
   --> $DIR/drop_copy.rs:38:5
@@ -45,6 +51,8 @@ LL |     drop(s5);
    |     ^^^^^--^
    |          |
    |          argument has type `&SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
 
 warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
   --> $DIR/drop_copy.rs:50:5
@@ -53,6 +61,8 @@ LL |     drop(a2);
    |     ^^^^^--^
    |          |
    |          argument has type `&AnotherStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
 
 warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
   --> $DIR/drop_copy.rs:52:5
@@ -61,6 +71,8 @@ LL |     drop(a4);
    |     ^^^^^--^
    |          |
    |          argument has type `&AnotherStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
 
 warning: calls to `std::mem::drop` with a value that implements `Copy` does nothing
   --> $DIR/drop_copy.rs:71:13
@@ -69,6 +81,8 @@ LL |             drop(println_and(13));
    |             ^^^^^---------------^
    |                  |
    |                  argument has type `i32`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
 
 warning: calls to `std::mem::drop` with a value that implements `Copy` does nothing
   --> $DIR/drop_copy.rs:74:14
@@ -77,6 +91,8 @@ LL |         3 if drop(println_and(14)) == () => (),
    |              ^^^^^---------------^
    |                   |
    |                   argument has type `i32`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
 
 warning: calls to `std::mem::drop` with a value that implements `Copy` does nothing
   --> $DIR/drop_copy.rs:76:14
@@ -85,6 +101,8 @@ LL |         4 => drop(2),
    |              ^^^^^-^
    |                   |
    |                   argument has type `i32`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
 
 warning: 10 warnings emitted
 
diff --git a/tests/ui/lint/drop_ref.stderr b/tests/ui/lint/drop_ref.stderr
index cd81f72d6e9..04c988fe99d 100644
--- a/tests/ui/lint/drop_ref.stderr
+++ b/tests/ui/lint/drop_ref.stderr
@@ -6,6 +6,7 @@ LL |     drop(&SomeStruct);
    |          |
    |          argument has type `&SomeStruct`
    |
+   = note: use `let _ = ...` to ignore the expression or result
 note: the lint level is defined here
   --> $DIR/drop_ref.rs:3:9
    |
@@ -19,6 +20,8 @@ LL |     drop(&owned1);
    |     ^^^^^-------^
    |          |
    |          argument has type `&SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
 
 warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
   --> $DIR/drop_ref.rs:12:5
@@ -27,6 +30,8 @@ LL |     drop(&&owned1);
    |     ^^^^^--------^
    |          |
    |          argument has type `&&SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
 
 warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
   --> $DIR/drop_ref.rs:13:5
@@ -35,6 +40,8 @@ LL |     drop(&mut owned1);
    |     ^^^^^-----------^
    |          |
    |          argument has type `&mut SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
 
 warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
   --> $DIR/drop_ref.rs:17:5
@@ -43,6 +50,8 @@ LL |     drop(reference1);
    |     ^^^^^----------^
    |          |
    |          argument has type `&SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
 
 warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
   --> $DIR/drop_ref.rs:20:5
@@ -51,6 +60,8 @@ LL |     drop(reference2);
    |     ^^^^^----------^
    |          |
    |          argument has type `&mut SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
 
 warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
   --> $DIR/drop_ref.rs:23:5
@@ -59,6 +70,8 @@ LL |     drop(reference3);
    |     ^^^^^----------^
    |          |
    |          argument has type `&SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
 
 warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
   --> $DIR/drop_ref.rs:28:5
@@ -67,6 +80,8 @@ LL |     drop(&val);
    |     ^^^^^----^
    |          |
    |          argument has type `&T`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
 
 warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
   --> $DIR/drop_ref.rs:36:5
@@ -75,6 +90,8 @@ LL |     std::mem::drop(&SomeStruct);
    |     ^^^^^^^^^^^^^^^-----------^
    |                    |
    |                    argument has type `&SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
 
 warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
   --> $DIR/drop_ref.rs:91:13
@@ -83,6 +100,8 @@ LL |             drop(println_and(&13));
    |             ^^^^^----------------^
    |                  |
    |                  argument has type `&i32`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
 
 warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
   --> $DIR/drop_ref.rs:94:14
@@ -91,6 +110,8 @@ LL |         3 if drop(println_and(&14)) == () => (),
    |              ^^^^^----------------^
    |                   |
    |                   argument has type `&i32`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
 
 warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
   --> $DIR/drop_ref.rs:96:14
@@ -99,6 +120,8 @@ LL |         4 => drop(&2),
    |              ^^^^^--^
    |                   |
    |                   argument has type `&i32`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
 
 warning: 12 warnings emitted
 
diff --git a/tests/ui/lint/forget_copy.stderr b/tests/ui/lint/forget_copy.stderr
index b5ce052d379..37bc8a8854e 100644
--- a/tests/ui/lint/forget_copy.stderr
+++ b/tests/ui/lint/forget_copy.stderr
@@ -6,6 +6,7 @@ LL |     forget(s1);
    |            |
    |            argument has type `SomeStruct`
    |
+   = note: use `let _ = ...` to ignore the expression or result
 note: the lint level is defined here
   --> $DIR/forget_copy.rs:3:9
    |
@@ -19,6 +20,8 @@ LL |     forget(s2);
    |     ^^^^^^^--^
    |            |
    |            argument has type `SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
 
 warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
   --> $DIR/forget_copy.rs:36:5
@@ -28,6 +31,7 @@ LL |     forget(s3);
    |            |
    |            argument has type `&SomeStruct`
    |
+   = note: use `let _ = ...` to ignore the expression or result
    = note: `#[warn(forget_ref)]` on by default
 
 warning: calls to `std::mem::forget` with a value that implements `Copy` does nothing
@@ -37,6 +41,8 @@ LL |     forget(s4);
    |     ^^^^^^^--^
    |            |
    |            argument has type `SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
 
 warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
   --> $DIR/forget_copy.rs:38:5
@@ -45,6 +51,8 @@ LL |     forget(s5);
    |     ^^^^^^^--^
    |            |
    |            argument has type `&SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
 
 warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
   --> $DIR/forget_copy.rs:50:5
@@ -53,6 +61,8 @@ LL |     forget(a2);
    |     ^^^^^^^--^
    |            |
    |            argument has type `&AnotherStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
 
 warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
   --> $DIR/forget_copy.rs:52:5
@@ -61,6 +71,8 @@ LL |     forget(a3);
    |     ^^^^^^^--^
    |            |
    |            argument has type `&AnotherStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
 
 warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
   --> $DIR/forget_copy.rs:53:5
@@ -69,6 +81,8 @@ LL |     forget(a4);
    |     ^^^^^^^--^
    |            |
    |            argument has type `&AnotherStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
 
 warning: 8 warnings emitted
 
diff --git a/tests/ui/lint/forget_ref.stderr b/tests/ui/lint/forget_ref.stderr
index f20f5f54b25..63fc7791980 100644
--- a/tests/ui/lint/forget_ref.stderr
+++ b/tests/ui/lint/forget_ref.stderr
@@ -6,6 +6,7 @@ LL |     forget(&SomeStruct);
    |            |
    |            argument has type `&SomeStruct`
    |
+   = note: use `let _ = ...` to ignore the expression or result
 note: the lint level is defined here
   --> $DIR/forget_ref.rs:3:9
    |
@@ -19,6 +20,8 @@ LL |     forget(&owned);
    |     ^^^^^^^------^
    |            |
    |            argument has type `&SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
 
 warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
   --> $DIR/forget_ref.rs:14:5
@@ -27,6 +30,8 @@ LL |     forget(&&owned);
    |     ^^^^^^^-------^
    |            |
    |            argument has type `&&SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
 
 warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
   --> $DIR/forget_ref.rs:15:5
@@ -35,6 +40,8 @@ LL |     forget(&mut owned);
    |     ^^^^^^^----------^
    |            |
    |            argument has type `&mut SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
 
 warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
   --> $DIR/forget_ref.rs:19:5
@@ -43,6 +50,8 @@ LL |     forget(&*reference1);
    |     ^^^^^^^------------^
    |            |
    |            argument has type `&SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
 
 warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
   --> $DIR/forget_ref.rs:22:5
@@ -51,6 +60,8 @@ LL |     forget(reference2);
    |     ^^^^^^^----------^
    |            |
    |            argument has type `&mut SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
 
 warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
   --> $DIR/forget_ref.rs:25:5
@@ -59,6 +70,8 @@ LL |     forget(reference3);
    |     ^^^^^^^----------^
    |            |
    |            argument has type `&SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
 
 warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
   --> $DIR/forget_ref.rs:30:5
@@ -67,6 +80,8 @@ LL |     forget(&val);
    |     ^^^^^^^----^
    |            |
    |            argument has type `&T`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
 
 warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
   --> $DIR/forget_ref.rs:38:5
@@ -75,6 +90,8 @@ LL |     std::mem::forget(&SomeStruct);
    |     ^^^^^^^^^^^^^^^^^-----------^
    |                      |
    |                      argument has type `&SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
 
 warning: 9 warnings emitted