Skip to content

Commit 224536f

Browse files
committed
Inline indent function
1 parent 9e794d7 commit 224536f

File tree

1 file changed

+3
-8
lines changed
  • compiler/rustc_ast_pretty/src

1 file changed

+3
-8
lines changed

compiler/rustc_ast_pretty/src/pp.rs

+3-8
Original file line numberDiff line numberDiff line change
@@ -366,12 +366,7 @@ impl Printer {
366366

367367
fn print_newline(&mut self, amount: isize) {
368368
self.out.push('\n');
369-
self.pending_indentation = 0;
370-
self.indent(amount);
371-
}
372-
373-
fn indent(&mut self, amount: isize) {
374-
self.pending_indentation += amount;
369+
self.pending_indentation = amount;
375370
}
376371

377372
fn get_top(&self) -> PrintFrame {
@@ -397,7 +392,7 @@ impl Printer {
397392
fn print_break(&mut self, token: BreakToken, size: isize) {
398393
match self.get_top() {
399394
PrintFrame::Fits => {
400-
self.indent(token.blank_space);
395+
self.pending_indentation += token.blank_space;
401396
self.space -= token.blank_space;
402397
}
403398
PrintFrame::Broken { offset, breaks: Breaks::Consistent } => {
@@ -409,7 +404,7 @@ impl Printer {
409404
self.print_newline(offset + token.offset);
410405
self.space = self.margin - (offset + token.offset);
411406
} else {
412-
self.indent(token.blank_space);
407+
self.pending_indentation += token.blank_space;
413408
self.space -= token.blank_space;
414409
}
415410
}

0 commit comments

Comments
 (0)