about summary refs log tree commit diff
path: root/src/tools/clippy/tests/ui/match_same_arms2.fixed
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clippy/tests/ui/match_same_arms2.fixed')
-rw-r--r--src/tools/clippy/tests/ui/match_same_arms2.fixed37
1 files changed, 24 insertions, 13 deletions
diff --git a/src/tools/clippy/tests/ui/match_same_arms2.fixed b/src/tools/clippy/tests/ui/match_same_arms2.fixed
index b7d377f1ebf..0d93e2c728d 100644
--- a/src/tools/clippy/tests/ui/match_same_arms2.fixed
+++ b/src/tools/clippy/tests/ui/match_same_arms2.fixed
@@ -14,6 +14,7 @@ fn foo() -> bool {
 
 fn match_same_arms() {
     let _ = match 42 {
+        //~^^^^^^^^^ match_same_arms
         _ => {
             foo();
             let mut a = 42 + [23].len() as i32;
@@ -24,15 +25,16 @@ fn match_same_arms() {
             a
         },
     };
-    //~^^^^^^^^^^^^^^^^^^^ ERROR: this match arm has an identical body to the `_` wildcard arm
 
     let _ = match 42 {
-        51 | 42 => foo(), //~ ERROR: this match arm has an identical body to another arm
+        51 | 42 => foo(),
+        //~^ match_same_arms
         _ => true,
     };
 
     let _ = match Some(42) {
-        None | Some(_) => 24, //~ ERROR: this match arm has an identical body to another arm
+        None | Some(_) => 24,
+        //~^ match_same_arms
     };
 
     let _ = match Some(42) {
@@ -53,7 +55,8 @@ fn match_same_arms() {
     };
 
     match (Some(42), Some(42)) {
-        (None, Some(a)) | (Some(a), None) => bar(a), //~ ERROR: this match arm has an identical body to another arm
+        (None, Some(a)) | (Some(a), None) => bar(a),
+        //~^ match_same_arms
         _ => (),
     }
 
@@ -66,12 +69,14 @@ fn match_same_arms() {
     };
 
     let _ = match (Some(42), Some(42)) {
-        (None, Some(a)) | (Some(a), None) if a == 42 => a, //~ ERROR: this match arm has an identical body to another arm
+        (None, Some(a)) | (Some(a), None) if a == 42 => a,
+        //~^ match_same_arms
         _ => 0,
     };
 
     match (Some(42), Some(42)) {
-        (Some(a), ..) | (.., Some(a)) => bar(a), //~ ERROR: this match arm has an identical body to another arm
+        (Some(a), ..) | (.., Some(a)) => bar(a),
+        //~^ match_same_arms
         _ => (),
     }
 
@@ -104,7 +109,8 @@ fn match_same_arms() {
     }
 
     match (x, Some(1i32)) {
-        (Ok(x), Some(_)) | (Ok(_), Some(x)) => println!("ok {}", x), //~ ERROR: this match arm has an identical body to another arm
+        (Ok(x), Some(_)) | (Ok(_), Some(x)) => println!("ok {}", x),
+        //~^ match_same_arms
         _ => println!("err"),
     }
 
@@ -118,7 +124,8 @@ fn match_same_arms() {
     // False negative #2251.
     match x {
         Ok(_tmp) => println!("ok"),
-        Ok(_) | Ok(3) => println!("ok"), //~ ERROR: this match arm has an identical body to another arm
+        Ok(_) | Ok(3) => println!("ok"),
+        //~^ match_same_arms
         Err(_) => {
             unreachable!();
         },
@@ -145,11 +152,11 @@ fn match_same_arms() {
         1 | 0 => {
             empty!(0);
         },
+        //~^^^ match_same_arms
         x => {
             empty!(x);
         },
     }
-    //~^^^^^^^ ERROR: this match arm has an identical body to another arm
 
     match_expr_like_matches_macro_priority();
 }
@@ -193,7 +200,8 @@ fn main() {
 
     // Suggest moving `Foo::Z(_)` up.
     let _ = match Foo::X(0) {
-        Foo::X(0) | Foo::Z(_) => 1, //~ ERROR: this match arm has an identical body to another arm
+        Foo::X(0) | Foo::Z(_) => 1,
+        //~^ match_same_arms
         Foo::X(_) | Foo::Y(_) => 2,
         _ => 0,
     };
@@ -201,7 +209,8 @@ fn main() {
     // Suggest moving `Foo::X(0)` down.
     let _ = match Foo::X(0) {
         Foo::Y(_) | Foo::Z(0) => 2,
-        Foo::Z(_) | Foo::X(0) => 1, //~ ERROR: this match arm has an identical body to another arm
+        Foo::Z(_) | Foo::X(0) => 1,
+        //~^ match_same_arms
         _ => 0,
     };
 
@@ -223,7 +232,8 @@ fn main() {
     let _ = match None {
         Some(Bar { y: 10, z: 0, .. }) => 2,
         None => 50,
-        Some(Bar { y: 0, x: 5, .. }) | Some(Bar { x: 0, y: 5, .. }) => 1, //~ ERROR: this match arm has an identical body to another arm
+        Some(Bar { y: 0, x: 5, .. }) | Some(Bar { x: 0, y: 5, .. }) => 1,
+        //~^ match_same_arms
         _ => 200,
     };
 
@@ -237,6 +247,7 @@ fn main() {
 
     let _ = match 0 {
         1 | 0 => cfg!(not_enable),
+        //~^ match_same_arms
         _ => false,
     };
 }
@@ -252,7 +263,7 @@ mod with_lifetime {
         fn get(&self) -> &'a str {
             match *self {
                 MaybeStaticStr::Borrowed(s) | MaybeStaticStr::Static(s) => s,
-                //~^ ERROR: this match arm has an identical body to another arm
+                //~^ match_same_arms
             }
         }
     }