Skip to content

Commit

Permalink
Inline indent function
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Jan 20, 2022
1 parent 9e794d7 commit 224536f
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions compiler/rustc_ast_pretty/src/pp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,12 +366,7 @@ impl Printer {

fn print_newline(&mut self, amount: isize) {
self.out.push('\n');
self.pending_indentation = 0;
self.indent(amount);
}

fn indent(&mut self, amount: isize) {
self.pending_indentation += amount;
self.pending_indentation = amount;
}

fn get_top(&self) -> PrintFrame {
Expand All @@ -397,7 +392,7 @@ impl Printer {
fn print_break(&mut self, token: BreakToken, size: isize) {
match self.get_top() {
PrintFrame::Fits => {
self.indent(token.blank_space);
self.pending_indentation += token.blank_space;
self.space -= token.blank_space;
}
PrintFrame::Broken { offset, breaks: Breaks::Consistent } => {
Expand All @@ -409,7 +404,7 @@ impl Printer {
self.print_newline(offset + token.offset);
self.space = self.margin - (offset + token.offset);
} else {
self.indent(token.blank_space);
self.pending_indentation += token.blank_space;
self.space -= token.blank_space;
}
}
Expand Down

0 comments on commit 224536f

Please sign in to comment.