about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Tolnay <dtolnay@gmail.com>2022-01-19 18:56:12 -0800
committerDavid Tolnay <dtolnay@gmail.com>2022-01-19 19:04:35 -0800
commit51eeb82d9db71bfb90ed6e0149d032787bcb3ee6 (patch)
tree44eea7b0fb32ef311c93c7616a280bde7adc20db
parent224536f4fee75a9825e7da0a8a332786cc1f52f8 (diff)
downloadrust-51eeb82d9db71bfb90ed6e0149d032787bcb3ee6.tar.gz
rust-51eeb82d9db71bfb90ed6e0149d032787bcb3ee6.zip
Inline print_newline function
-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;