diff --git a/tests/ui/match_same_arms2.rs b/tests/ui/match_same_arms2.rs
index 21b1c439e84..e1401d2796a 100644
--- a/tests/ui/match_same_arms2.rs
+++ b/tests/ui/match_same_arms2.rs
@@ -79,6 +79,46 @@ fn match_same_arms() {
         (None, Some(a)) => bar(a), // bindings have different types
         _ => (),
     }
+
+    let x: Result<i32, &str> = Ok(3);
+
+    // No warning because of the guard.
+    match x {
+        Ok(x) if x * x == 64 => println!("ok"),
+        Ok(_) => println!("ok"),
+        Err(_) => println!("err"),
+    }
+
+    // This used to be a false positive; see issue #1996.
+    match x {
+        Ok(3) => println!("ok"),
+        Ok(x) if x * x == 64 => println!("ok 64"),
+        Ok(_) => println!("ok"),
+        Err(_) => println!("err"),
+    }
+
+    match (x, Some(1i32)) {
+        (Ok(x), Some(_)) => println!("ok {}", x),
+        (Ok(_), Some(x)) => println!("ok {}", x),
+        _ => println!("err"),
+    }
+
+    // No warning; different types for `x`.
+    match (x, Some(1.0f64)) {
+        (Ok(x), Some(_)) => println!("ok {}", x),
+        (Ok(_), Some(x)) => println!("ok {}", x),
+        _ => println!("err"),
+    }
+
+    // False negative #2251.
+    match x {
+        Ok(_tmp) => println!("ok"),
+        Ok(3) => println!("ok"),
+        Ok(_) => println!("ok"),
+        Err(_) => {
+            unreachable!();
+        },
+    }
 }
 
 fn main() {}
diff --git a/tests/ui/match_same_arms2.stderr b/tests/ui/match_same_arms2.stderr
index e34c2c30ab8..28abb2fc9bf 100644
--- a/tests/ui/match_same_arms2.stderr
+++ b/tests/ui/match_same_arms2.stderr
@@ -105,5 +105,41 @@ help: consider refactoring into `(Some(a), ..) | (.., Some(a))`
 LL |         (Some(a), ..) => bar(a),
    |         ^^^^^^^^^^^^^
 
-error: aborting due to 5 previous errors
+error: this `match` has identical arm bodies
+  --> $DIR/match_same_arms2.rs:102:29
+   |
+LL |         (Ok(_), Some(x)) => println!("ok {}", x),
+   |                             ^^^^^^^^^^^^^^^^^^^^
+   |
+note: same as this
+  --> $DIR/match_same_arms2.rs:101:29
+   |
+LL |         (Ok(x), Some(_)) => println!("ok {}", x),
+   |                             ^^^^^^^^^^^^^^^^^^^^
+help: consider refactoring into `(Ok(x), Some(_)) | (Ok(_), Some(x))`
+  --> $DIR/match_same_arms2.rs:101:9
+   |
+LL |         (Ok(x), Some(_)) => println!("ok {}", x),
+   |         ^^^^^^^^^^^^^^^^
+   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+
+error: this `match` has identical arm bodies
+  --> $DIR/match_same_arms2.rs:117:18
+   |
+LL |         Ok(_) => println!("ok"),
+   |                  ^^^^^^^^^^^^^^
+   |
+note: same as this
+  --> $DIR/match_same_arms2.rs:116:18
+   |
+LL |         Ok(3) => println!("ok"),
+   |                  ^^^^^^^^^^^^^^
+help: consider refactoring into `Ok(3) | Ok(_)`
+  --> $DIR/match_same_arms2.rs:116:9
+   |
+LL |         Ok(3) => println!("ok"),
+   |         ^^^^^
+   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+
+error: aborting due to 7 previous errors
 
diff --git a/tests/ui/match_wild_err_arm.rs b/tests/ui/match_wild_err_arm.rs
new file mode 100644
index 00000000000..823be65efe0
--- /dev/null
+++ b/tests/ui/match_wild_err_arm.rs
@@ -0,0 +1,65 @@
+#![feature(exclusive_range_pattern)]
+#![allow(clippy::match_same_arms)]
+#![warn(clippy::match_wild_err_arm)]
+
+fn match_wild_err_arm() {
+    let x: Result<i32, &str> = Ok(3);
+
+    match x {
+        Ok(3) => println!("ok"),
+        Ok(_) => println!("ok"),
+        Err(_) => panic!("err"),
+    }
+
+    match x {
+        Ok(3) => println!("ok"),
+        Ok(_) => println!("ok"),
+        Err(_) => panic!(),
+    }
+
+    match x {
+        Ok(3) => println!("ok"),
+        Ok(_) => println!("ok"),
+        Err(_) => {
+            panic!();
+        },
+    }
+
+    match x {
+        Ok(3) => println!("ok"),
+        Ok(_) => println!("ok"),
+        Err(_e) => panic!(),
+    }
+
+    // Allowed when used in `panic!`.
+    match x {
+        Ok(3) => println!("ok"),
+        Ok(_) => println!("ok"),
+        Err(_e) => panic!("{}", _e),
+    }
+
+    // Allowed when not with `panic!` block.
+    match x {
+        Ok(3) => println!("ok"),
+        Ok(_) => println!("ok"),
+        Err(_) => println!("err"),
+    }
+
+    // Allowed when used with `unreachable!`.
+    match x {
+        Ok(3) => println!("ok"),
+        Ok(_) => println!("ok"),
+        Err(_) => unreachable!(),
+    }
+
+    // Allowed when used with `unreachable!`.
+    match x {
+        Ok(3) => println!("ok"),
+        Ok(_) => println!("ok"),
+        Err(_) => {
+            unreachable!();
+        },
+    }
+}
+
+fn main() {}
diff --git a/tests/ui/match_wild_err_arm.stderr b/tests/ui/match_wild_err_arm.stderr
new file mode 100644
index 00000000000..20d4c933418
--- /dev/null
+++ b/tests/ui/match_wild_err_arm.stderr
@@ -0,0 +1,35 @@
+error: `Err(_)` matches all errors
+  --> $DIR/match_wild_err_arm.rs:11:9
+   |
+LL |         Err(_) => panic!("err"),
+   |         ^^^^^^
+   |
+   = note: `-D clippy::match-wild-err-arm` implied by `-D warnings`
+   = note: match each error separately or use the error output
+
+error: `Err(_)` matches all errors
+  --> $DIR/match_wild_err_arm.rs:17:9
+   |
+LL |         Err(_) => panic!(),
+   |         ^^^^^^
+   |
+   = note: match each error separately or use the error output
+
+error: `Err(_)` matches all errors
+  --> $DIR/match_wild_err_arm.rs:23:9
+   |
+LL |         Err(_) => {
+   |         ^^^^^^
+   |
+   = note: match each error separately or use the error output
+
+error: `Err(_e)` matches all errors
+  --> $DIR/match_wild_err_arm.rs:31:9
+   |
+LL |         Err(_e) => panic!(),
+   |         ^^^^^^^
+   |
+   = note: match each error separately or use the error output
+
+error: aborting due to 4 previous errors
+
diff --git a/tests/ui/matches.rs b/tests/ui/matches.rs
deleted file mode 100644
index 2ce0b574929..00000000000
--- a/tests/ui/matches.rs
+++ /dev/null
@@ -1,111 +0,0 @@
-#![feature(exclusive_range_pattern)]
-#![warn(clippy::all)]
-#![allow(unused, clippy::redundant_pattern_matching, clippy::too_many_lines)]
-#![warn(clippy::match_same_arms)]
-
-fn dummy() {}
-
-fn match_wild_err_arm() {
-    let x: Result<i32, &str> = Ok(3);
-
-    match x {
-        Ok(3) => println!("ok"),
-        Ok(_) => println!("ok"),
-        Err(_) => panic!("err"),
-    }
-
-    match x {
-        Ok(3) => println!("ok"),
-        Ok(_) => println!("ok"),
-        Err(_) => panic!(),
-    }
-
-    match x {
-        Ok(3) => println!("ok"),
-        Ok(_) => println!("ok"),
-        Err(_) => {
-            panic!();
-        },
-    }
-
-    match x {
-        Ok(3) => println!("ok"),
-        Ok(_) => println!("ok"),
-        Err(_e) => panic!(),
-    }
-
-    // Allowed when used in `panic!`.
-    match x {
-        Ok(3) => println!("ok"),
-        Ok(_) => println!("ok"),
-        Err(_e) => panic!("{}", _e),
-    }
-
-    // Allowed when not with `panic!` block.
-    match x {
-        Ok(3) => println!("ok"),
-        Ok(_) => println!("ok"),
-        Err(_) => println!("err"),
-    }
-
-    // Allowed when used with `unreachable!`.
-    match x {
-        Ok(3) => println!("ok"),
-        Ok(_) => println!("ok"),
-        Err(_) => unreachable!(),
-    }
-
-    match x {
-        Ok(3) => println!("ok"),
-        Ok(_) => println!("ok"),
-        Err(_) => unreachable!(),
-    }
-
-    match x {
-        Ok(3) => println!("ok"),
-        Ok(_) => println!("ok"),
-        Err(_) => {
-            unreachable!();
-        },
-    }
-
-    // No warning because of the guard.
-    match x {
-        Ok(x) if x * x == 64 => println!("ok"),
-        Ok(_) => println!("ok"),
-        Err(_) => println!("err"),
-    }
-
-    // This used to be a false positive; see issue #1996.
-    match x {
-        Ok(3) => println!("ok"),
-        Ok(x) if x * x == 64 => println!("ok 64"),
-        Ok(_) => println!("ok"),
-        Err(_) => println!("err"),
-    }
-
-    match (x, Some(1i32)) {
-        (Ok(x), Some(_)) => println!("ok {}", x),
-        (Ok(_), Some(x)) => println!("ok {}", x),
-        _ => println!("err"),
-    }
-
-    // No warning; different types for `x`.
-    match (x, Some(1.0f64)) {
-        (Ok(x), Some(_)) => println!("ok {}", x),
-        (Ok(_), Some(x)) => println!("ok {}", x),
-        _ => println!("err"),
-    }
-
-    // Because of a bug, no warning was generated for this case before #2251.
-    match x {
-        Ok(_tmp) => println!("ok"),
-        Ok(3) => println!("ok"),
-        Ok(_) => println!("ok"),
-        Err(_) => {
-            unreachable!();
-        },
-    }
-}
-
-fn main() {}
diff --git a/tests/ui/matches.stderr b/tests/ui/matches.stderr
deleted file mode 100644
index 1c5c636fee6..00000000000
--- a/tests/ui/matches.stderr
+++ /dev/null
@@ -1,234 +0,0 @@
-error: `Err(_)` matches all errors
-  --> $DIR/matches.rs:14:9
-   |
-LL |         Err(_) => panic!("err"),
-   |         ^^^^^^
-   |
-   = note: `-D clippy::match-wild-err-arm` implied by `-D warnings`
-   = note: match each error separately or use the error output
-
-error: this `match` has identical arm bodies
-  --> $DIR/matches.rs:13:18
-   |
-LL |         Ok(_) => println!("ok"),
-   |                  ^^^^^^^^^^^^^^
-   |
-   = note: `-D clippy::match-same-arms` implied by `-D warnings`
-note: same as this
-  --> $DIR/matches.rs:12:18
-   |
-LL |         Ok(3) => println!("ok"),
-   |                  ^^^^^^^^^^^^^^
-help: consider refactoring into `Ok(3) | Ok(_)`
-  --> $DIR/matches.rs:12:9
-   |
-LL |         Ok(3) => println!("ok"),
-   |         ^^^^^
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
-
-error: `Err(_)` matches all errors
-  --> $DIR/matches.rs:20:9
-   |
-LL |         Err(_) => panic!(),
-   |         ^^^^^^
-   |
-   = note: match each error separately or use the error output
-
-error: this `match` has identical arm bodies
-  --> $DIR/matches.rs:19:18
-   |
-LL |         Ok(_) => println!("ok"),
-   |                  ^^^^^^^^^^^^^^
-   |
-note: same as this
-  --> $DIR/matches.rs:18:18
-   |
-LL |         Ok(3) => println!("ok"),
-   |                  ^^^^^^^^^^^^^^
-help: consider refactoring into `Ok(3) | Ok(_)`
-  --> $DIR/matches.rs:18:9
-   |
-LL |         Ok(3) => println!("ok"),
-   |         ^^^^^
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
-
-error: `Err(_)` matches all errors
-  --> $DIR/matches.rs:26:9
-   |
-LL |         Err(_) => {
-   |         ^^^^^^
-   |
-   = note: match each error separately or use the error output
-
-error: this `match` has identical arm bodies
-  --> $DIR/matches.rs:25:18
-   |
-LL |         Ok(_) => println!("ok"),
-   |                  ^^^^^^^^^^^^^^
-   |
-note: same as this
-  --> $DIR/matches.rs:24:18
-   |
-LL |         Ok(3) => println!("ok"),
-   |                  ^^^^^^^^^^^^^^
-help: consider refactoring into `Ok(3) | Ok(_)`
-  --> $DIR/matches.rs:24:9
-   |
-LL |         Ok(3) => println!("ok"),
-   |         ^^^^^
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
-
-error: `Err(_e)` matches all errors
-  --> $DIR/matches.rs:34:9
-   |
-LL |         Err(_e) => panic!(),
-   |         ^^^^^^^
-   |
-   = note: match each error separately or use the error output
-
-error: this `match` has identical arm bodies
-  --> $DIR/matches.rs:33:18
-   |
-LL |         Ok(_) => println!("ok"),
-   |                  ^^^^^^^^^^^^^^
-   |
-note: same as this
-  --> $DIR/matches.rs:32:18
-   |
-LL |         Ok(3) => println!("ok"),
-   |                  ^^^^^^^^^^^^^^
-help: consider refactoring into `Ok(3) | Ok(_)`
-  --> $DIR/matches.rs:32:9
-   |
-LL |         Ok(3) => println!("ok"),
-   |         ^^^^^
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
-
-error: this `match` has identical arm bodies
-  --> $DIR/matches.rs:40:18
-   |
-LL |         Ok(_) => println!("ok"),
-   |                  ^^^^^^^^^^^^^^
-   |
-note: same as this
-  --> $DIR/matches.rs:39:18
-   |
-LL |         Ok(3) => println!("ok"),
-   |                  ^^^^^^^^^^^^^^
-help: consider refactoring into `Ok(3) | Ok(_)`
-  --> $DIR/matches.rs:39:9
-   |
-LL |         Ok(3) => println!("ok"),
-   |         ^^^^^
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
-
-error: this `match` has identical arm bodies
-  --> $DIR/matches.rs:47:18
-   |
-LL |         Ok(_) => println!("ok"),
-   |                  ^^^^^^^^^^^^^^
-   |
-note: same as this
-  --> $DIR/matches.rs:46:18
-   |
-LL |         Ok(3) => println!("ok"),
-   |                  ^^^^^^^^^^^^^^
-help: consider refactoring into `Ok(3) | Ok(_)`
-  --> $DIR/matches.rs:46:9
-   |
-LL |         Ok(3) => println!("ok"),
-   |         ^^^^^
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
-
-error: this `match` has identical arm bodies
-  --> $DIR/matches.rs:54:18
-   |
-LL |         Ok(_) => println!("ok"),
-   |                  ^^^^^^^^^^^^^^
-   |
-note: same as this
-  --> $DIR/matches.rs:53:18
-   |
-LL |         Ok(3) => println!("ok"),
-   |                  ^^^^^^^^^^^^^^
-help: consider refactoring into `Ok(3) | Ok(_)`
-  --> $DIR/matches.rs:53:9
-   |
-LL |         Ok(3) => println!("ok"),
-   |         ^^^^^
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
-
-error: this `match` has identical arm bodies
-  --> $DIR/matches.rs:60:18
-   |
-LL |         Ok(_) => println!("ok"),
-   |                  ^^^^^^^^^^^^^^
-   |
-note: same as this
-  --> $DIR/matches.rs:59:18
-   |
-LL |         Ok(3) => println!("ok"),
-   |                  ^^^^^^^^^^^^^^
-help: consider refactoring into `Ok(3) | Ok(_)`
-  --> $DIR/matches.rs:59:9
-   |
-LL |         Ok(3) => println!("ok"),
-   |         ^^^^^
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
-
-error: this `match` has identical arm bodies
-  --> $DIR/matches.rs:66:18
-   |
-LL |         Ok(_) => println!("ok"),
-   |                  ^^^^^^^^^^^^^^
-   |
-note: same as this
-  --> $DIR/matches.rs:65:18
-   |
-LL |         Ok(3) => println!("ok"),
-   |                  ^^^^^^^^^^^^^^
-help: consider refactoring into `Ok(3) | Ok(_)`
-  --> $DIR/matches.rs:65:9
-   |
-LL |         Ok(3) => println!("ok"),
-   |         ^^^^^
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
-
-error: this `match` has identical arm bodies
-  --> $DIR/matches.rs:89:29
-   |
-LL |         (Ok(_), Some(x)) => println!("ok {}", x),
-   |                             ^^^^^^^^^^^^^^^^^^^^
-   |
-note: same as this
-  --> $DIR/matches.rs:88:29
-   |
-LL |         (Ok(x), Some(_)) => println!("ok {}", x),
-   |                             ^^^^^^^^^^^^^^^^^^^^
-help: consider refactoring into `(Ok(x), Some(_)) | (Ok(_), Some(x))`
-  --> $DIR/matches.rs:88:9
-   |
-LL |         (Ok(x), Some(_)) => println!("ok {}", x),
-   |         ^^^^^^^^^^^^^^^^
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
-
-error: this `match` has identical arm bodies
-  --> $DIR/matches.rs:104:18
-   |
-LL |         Ok(_) => println!("ok"),
-   |                  ^^^^^^^^^^^^^^
-   |
-note: same as this
-  --> $DIR/matches.rs:103:18
-   |
-LL |         Ok(3) => println!("ok"),
-   |                  ^^^^^^^^^^^^^^
-help: consider refactoring into `Ok(3) | Ok(_)`
-  --> $DIR/matches.rs:103:9
-   |
-LL |         Ok(3) => println!("ok"),
-   |         ^^^^^
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
-
-error: aborting due to 15 previous errors
-