about summary refs log tree commit diff
path: root/src/tools/rustfmt/tests
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/rustfmt/tests')
-rw-r--r--src/tools/rustfmt/tests/target/guard_patterns.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/tools/rustfmt/tests/target/guard_patterns.rs b/src/tools/rustfmt/tests/target/guard_patterns.rs
new file mode 100644
index 00000000000..2e4667b916c
--- /dev/null
+++ b/src/tools/rustfmt/tests/target/guard_patterns.rs
@@ -0,0 +1,12 @@
+#![feature(guard_patterns)]
+
+fn main() {
+    match user.subscription_plan() {
+        (Plan::Regular if user.credit() >= 100) | (Plan::Premium if user.credit() >= 80) => {
+            // Complete the transaction.
+        }
+        _ => {
+            // The user doesn't have enough credit, return an error message.
+        }
+    }
+}