summaryrefslogtreecommitdiffstats
path: root/tests/ui/lint/lint-struct-necessary.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/lint/lint-struct-necessary.rs')
-rw-r--r--tests/ui/lint/lint-struct-necessary.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/ui/lint/lint-struct-necessary.rs b/tests/ui/lint/lint-struct-necessary.rs
new file mode 100644
index 000000000..8bc3c1205
--- /dev/null
+++ b/tests/ui/lint/lint-struct-necessary.rs
@@ -0,0 +1,31 @@
+#![allow(dead_code)]
+#![deny(unused_parens)]
+
+enum State {
+ Waiting { start_at: u64 }
+}
+struct Foo {}
+
+fn main() {
+ let e = &mut State::Waiting { start_at: 0u64 };
+ match (&mut State::Waiting { start_at: 0u64 }) {
+ _ => {}
+ }
+
+ match (e) {
+ //~^ ERROR unnecessary parentheses around `match` scrutinee expression
+ _ => {}
+ }
+
+ match &(State::Waiting { start_at: 0u64 }) {
+ _ => {}
+ }
+
+ match (State::Waiting { start_at: 0u64 }) {
+ _ => {}
+ }
+
+ match (&&Foo {}) {
+ _ => {}
+ }
+}