about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorJason Newcomb <jsnewcomb@pm.me>2022-02-17 14:16:21 -0500
committerJason Newcomb <jsnewcomb@pm.me>2022-02-17 14:16:21 -0500
commit8912d659cdc9e1fd787136fe1b52a285f2fc2106 (patch)
treecfe0936d66c05628a4f49ea1fcc6400f634cd049 /tests
parent8ce2d46cacc8b91f1d252d52cb38f397ee990435 (diff)
downloadrust-8912d659cdc9e1fd787136fe1b52a285f2fc2106.tar.gz
rust-8912d659cdc9e1fd787136fe1b52a285f2fc2106.zip
Remove hack testing for `cfg` attribute in `match_single_binding`
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/match_single_binding.fixed8
-rw-r--r--tests/ui/match_single_binding.rs3
-rw-r--r--tests/ui/match_single_binding.stderr11
3 files changed, 15 insertions, 7 deletions
diff --git a/tests/ui/match_single_binding.fixed b/tests/ui/match_single_binding.fixed
index b4ec525ada0..b8dc8179f7d 100644
--- a/tests/ui/match_single_binding.fixed
+++ b/tests/ui/match_single_binding.fixed
@@ -106,10 +106,8 @@ fn main() {
         0 => println!("Array index start"),
         _ => println!("Not an array index start"),
     }
-    // False negative
+
+    // Lint
     let x = 1;
-    match x {
-        // =>
-        _ => println!("Not an array index start"),
-    }
+    println!("Not an array index start");
 }
diff --git a/tests/ui/match_single_binding.rs b/tests/ui/match_single_binding.rs
index e04c4018b98..fe63dcd63f2 100644
--- a/tests/ui/match_single_binding.rs
+++ b/tests/ui/match_single_binding.rs
@@ -118,7 +118,8 @@ fn main() {
         0 => println!("Array index start"),
         _ => println!("Not an array index start"),
     }
-    // False negative
+
+    // Lint
     let x = 1;
     match x {
         // =>
diff --git a/tests/ui/match_single_binding.stderr b/tests/ui/match_single_binding.stderr
index 291fa77dc2e..d939291f53c 100644
--- a/tests/ui/match_single_binding.stderr
+++ b/tests/ui/match_single_binding.stderr
@@ -167,5 +167,14 @@ LL +             unwrapped
 LL ~         })
    |
 
-error: aborting due to 11 previous errors
+error: this match could be replaced by its body itself
+  --> $DIR/match_single_binding.rs:124:5
+   |
+LL | /     match x {
+LL | |         // =>
+LL | |         _ => println!("Not an array index start"),
+LL | |     }
+   | |_____^ help: consider using the match body instead: `println!("Not an array index start");`
+
+error: aborting due to 12 previous errors