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, 4 insertions, 7 deletions
diff --git a/compiler/rustc_ast_pretty/src/pp.rs b/compiler/rustc_ast_pretty/src/pp.rs
index 726c114b10b..9fc9282ac80 100644
--- a/compiler/rustc_ast_pretty/src/pp.rs
+++ b/compiler/rustc_ast_pretty/src/pp.rs
@@ -364,11 +364,6 @@ impl Printer {
         }
     }
 
-    fn print_newline(&mut self, amount: isize) {
-        self.out.push('\n');
-        self.pending_indentation = amount;
-    }
-
     fn get_top(&self) -> PrintFrame {
         *self
             .print_stack
@@ -396,12 +391,14 @@ impl Printer {
                 self.space -= token.blank_space;
             }
             PrintFrame::Broken { offset, breaks: Breaks::Consistent } => {
-                self.print_newline(offset + token.offset);
+                self.out.push('\n');
+                self.pending_indentation = offset + token.offset;
                 self.space = self.margin - (offset + token.offset);
             }
             PrintFrame::Broken { offset, breaks: Breaks::Inconsistent } => {
                 if size > self.space {
-                    self.print_newline(offset + token.offset);
+                    self.out.push('\n');
+                    self.pending_indentation = offset + token.offset;
                     self.space = self.margin - (offset + token.offset);
                 } else {
                     self.pending_indentation += token.blank_space;