]> git.proxmox.com Git - rustc.git/blobdiff - src/tools/rustfmt/tests/target/label_break.rs
New upstream version 1.52.1+dfsg1
[rustc.git] / src / tools / rustfmt / tests / target / label_break.rs
diff --git a/src/tools/rustfmt/tests/target/label_break.rs b/src/tools/rustfmt/tests/target/label_break.rs
new file mode 100644 (file)
index 0000000..728d781
--- /dev/null
@@ -0,0 +1,28 @@
+// format with label break value.
+fn main() {
+    'empty_block: {}
+
+    'block: {
+        do_thing();
+        if condition_not_met() {
+            break 'block;
+        }
+        do_next_thing();
+        if condition_not_met() {
+            break 'block;
+        }
+        do_last_thing();
+    }
+
+    let result = 'block: {
+        if foo() {
+            // comment
+            break 'block 1;
+        }
+        if bar() {
+            /* comment */
+            break 'block 2;
+        }
+        3
+    };
+}