Skip to content

Commit 9af0842

Browse files
committed
Avoid an indent for labelled loops.
1 parent 809e5b5 commit 9af0842

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

compiler/rustc_ast_pretty/src/pprust/state/expr.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -485,12 +485,12 @@ impl<'a> State<'a> {
485485
self.print_block_with_attrs(body, attrs, cb, ib);
486486
}
487487
ast::ExprKind::Loop(blk, opt_label, _) => {
488+
let cb = self.cbox(0);
489+
let ib = self.ibox(0);
488490
if let Some(label) = opt_label {
489491
self.print_ident(label.ident);
490492
self.word_space(":");
491493
}
492-
let cb = self.cbox(0);
493-
let ib = self.ibox(0);
494494
self.word_nbsp("loop");
495495
self.print_block_with_attrs(blk, attrs, cb, ib);
496496
}

compiler/rustc_hir_pretty/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1526,12 +1526,12 @@ impl<'a> State<'a> {
15261526
self.print_if(test, blk, elseopt);
15271527
}
15281528
hir::ExprKind::Loop(blk, opt_label, _, _) => {
1529+
let cb = self.cbox(0);
1530+
let ib = self.ibox(0);
15291531
if let Some(label) = opt_label {
15301532
self.print_ident(label.ident);
15311533
self.word_space(":");
15321534
}
1533-
let cb = self.cbox(0);
1534-
let ib = self.ibox(0);
15351535
self.word_nbsp("loop");
15361536
self.print_block(blk, cb, ib);
15371537
}

tests/ui/unpretty/exhaustive.hir.stdout

+1-2
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,7 @@ mod expressions {
189189
let _t =
190190
match #[lang = "into_iter"](x) {
191191
mut iter =>
192-
'a:
193-
loop {
192+
'a: loop {
194193
match #[lang = "next"](&mut iter) {
195194
#[lang = "None"] {} => break,
196195
#[lang = "Some"] { 0: _ } => { }

0 commit comments

Comments
 (0)