about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Tolnay <dtolnay@gmail.com>2022-01-18 19:04:12 -0800
committerDavid Tolnay <dtolnay@gmail.com>2022-01-18 19:04:12 -0800
commite219b2b5f90bf48bf56533c16745f2ce85216a2c (patch)
treec866cf66adf8b6d3de1972b1bb38397e7a07140d
parentfdb95f54e81532f5a620e79b8930f89e0e9aee80 (diff)
downloadrust-e219b2b5f90bf48bf56533c16745f2ce85216a2c.tar.gz
rust-e219b2b5f90bf48bf56533c16745f2ce85216a2c.zip
Inline Printer's scan_push method
-rw-r--r--compiler/rustc_ast_pretty/src/pp.rs14
1 files changed, 6 insertions, 8 deletions
diff --git a/compiler/rustc_ast_pretty/src/pp.rs b/compiler/rustc_ast_pretty/src/pp.rs
index 785125ccafc..4f5140349c9 100644
--- a/compiler/rustc_ast_pretty/src/pp.rs
+++ b/compiler/rustc_ast_pretty/src/pp.rs
@@ -293,7 +293,8 @@ impl Printer {
             self.right += 1;
             self.buf.advance_right();
         }
-        self.scan_push(BufEntry { token: Token::Begin(b), size: -self.right_total });
+        self.buf[self.right] = BufEntry { token: Token::Begin(b), size: -self.right_total };
+        self.scan_stack.push_front(self.right);
     }
 
     fn scan_end(&mut self) {
@@ -302,7 +303,8 @@ impl Printer {
         } else {
             self.right += 1;
             self.buf.advance_right();
-            self.scan_push(BufEntry { token: Token::End, size: -1 });
+            self.buf[self.right] = BufEntry { token: Token::End, size: -1 };
+            self.scan_stack.push_front(self.right);
         }
     }
 
@@ -317,7 +319,8 @@ impl Printer {
             self.buf.advance_right();
         }
         self.check_stack(0);
-        self.scan_push(BufEntry { token: Token::Break(b), size: -self.right_total });
+        self.buf[self.right] = BufEntry { token: Token::Break(b), size: -self.right_total };
+        self.scan_stack.push_front(self.right);
         self.right_total += b.blank_space;
     }
 
@@ -347,11 +350,6 @@ impl Printer {
         }
     }
 
-    fn scan_push(&mut self, entry: BufEntry) {
-        self.buf[self.right] = entry;
-        self.scan_stack.push_front(self.right);
-    }
-
     fn scan_pop(&mut self) -> usize {
         self.scan_stack.pop_front().unwrap()
     }