From 09f9947ebc68a8199c3dff8607a41571c48cc377 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Sat, 28 Sep 2019 16:05:38 +0200 Subject: Gather together usefulness tests I took most tests that were testing only for match exhaustiveness, pattern refutability or match arm reachability, and put them in the same test folder. --- src/test/ui/structs/struct-like-enum-nonexhaustive.rs | 12 ------------ .../ui/structs/struct-like-enum-nonexhaustive.stderr | 18 ------------------ src/test/ui/structs/struct-pattern-match-useless.rs | 15 --------------- .../ui/structs/struct-pattern-match-useless.stderr | 14 -------------- 4 files changed, 59 deletions(-) delete mode 100644 src/test/ui/structs/struct-like-enum-nonexhaustive.rs delete mode 100644 src/test/ui/structs/struct-like-enum-nonexhaustive.stderr delete mode 100644 src/test/ui/structs/struct-pattern-match-useless.rs delete mode 100644 src/test/ui/structs/struct-pattern-match-useless.stderr (limited to 'src/test/ui/structs') diff --git a/src/test/ui/structs/struct-like-enum-nonexhaustive.rs b/src/test/ui/structs/struct-like-enum-nonexhaustive.rs deleted file mode 100644 index b1fc0f5ad3e..00000000000 --- a/src/test/ui/structs/struct-like-enum-nonexhaustive.rs +++ /dev/null @@ -1,12 +0,0 @@ -enum A { - B { x: Option }, - C -} - -fn main() { - let x = A::B { x: Some(3) }; - match x { //~ ERROR non-exhaustive patterns - A::C => {} - A::B { x: None } => {} - } -} diff --git a/src/test/ui/structs/struct-like-enum-nonexhaustive.stderr b/src/test/ui/structs/struct-like-enum-nonexhaustive.stderr deleted file mode 100644 index d6b5af17964..00000000000 --- a/src/test/ui/structs/struct-like-enum-nonexhaustive.stderr +++ /dev/null @@ -1,18 +0,0 @@ -error[E0004]: non-exhaustive patterns: `B { x: Some(_) }` not covered - --> $DIR/struct-like-enum-nonexhaustive.rs:8:11 - | -LL | / enum A { -LL | | B { x: Option }, - | | - not covered -LL | | C -LL | | } - | |_- `A` defined here -... -LL | match x { - | ^ pattern `B { x: Some(_) }` not covered - | - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0004`. diff --git a/src/test/ui/structs/struct-pattern-match-useless.rs b/src/test/ui/structs/struct-pattern-match-useless.rs deleted file mode 100644 index 93f0a931761..00000000000 --- a/src/test/ui/structs/struct-pattern-match-useless.rs +++ /dev/null @@ -1,15 +0,0 @@ -#![deny(unreachable_patterns)] - -struct Foo { - x: isize, - y: isize, -} - -pub fn main() { - let a = Foo { x: 1, y: 2 }; - match a { - Foo { x: _x, y: _y } => (), - Foo { .. } => () //~ ERROR unreachable pattern - } - -} diff --git a/src/test/ui/structs/struct-pattern-match-useless.stderr b/src/test/ui/structs/struct-pattern-match-useless.stderr deleted file mode 100644 index 5b0c9305448..00000000000 --- a/src/test/ui/structs/struct-pattern-match-useless.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: unreachable pattern - --> $DIR/struct-pattern-match-useless.rs:12:9 - | -LL | Foo { .. } => () - | ^^^^^^^^^^ - | -note: lint level defined here - --> $DIR/struct-pattern-match-useless.rs:1:9 - | -LL | #![deny(unreachable_patterns)] - | ^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to previous error - -- cgit 1.4.1-3-g733a5