about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Tolnay <dtolnay@gmail.com>2022-01-19 18:55:24 -0800
committerDavid Tolnay <dtolnay@gmail.com>2022-01-19 19:04:35 -0800
commit224536f4fee75a9825e7da0a8a332786cc1f52f8 (patch)
tree9f1ff1f129f99ed714d1e945662a80d230b173de
parent9e794d7de3adcf4e91b04e1a05d4f84c86b54f66 (diff)
downloadrust-224536f4fee75a9825e7da0a8a332786cc1f52f8.tar.gz
rust-224536f4fee75a9825e7da0a8a332786cc1f52f8.zip
Inline indent function
-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;
                 }
             }