]> git.proxmox.com Git - rustc.git/blobdiff - src/tools/rustfmt/tests/source/label_break.rs
Update upstream source from tag 'upstream/1.52.1+dfsg1'
[rustc.git] / src / tools / rustfmt / tests / source / label_break.rs
diff --git a/src/tools/rustfmt/tests/source/label_break.rs b/src/tools/rustfmt/tests/source/label_break.rs
new file mode 100644 (file)
index 0000000..2c79fd3
--- /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
+};
+}
\ No newline at end of file