about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--compiler/rustc_ast_pretty/src/pp.rs11
1 files changed, 3 insertions, 8 deletions
diff --git a/compiler/rustc_ast_pretty/src/pp.rs b/compiler/rustc_ast_pretty/src/pp.rs
index de57820d261..726c114b10b 100644
--- a/compiler/rustc_ast_pretty/src/pp.rs
+++ b/compiler/rustc_ast_pretty/src/pp.rs
@@ -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 {
@@ -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 } => {
@@ -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;
                 }
             }