summaryrefslogtreecommitdiffstats
path: root/src/tools/rustfmt/tests/source/label_break.rs
blob: 2c79fd35e70caa51af16f8bae8932c5669baa181 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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
};
}