about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Tolnay <dtolnay@gmail.com>2022-01-18 19:23:22 -0800
committerDavid Tolnay <dtolnay@gmail.com>2022-01-18 19:23:22 -0800
commitfe5c4eab2dbc646f60f748b4b348acf5202ebf59 (patch)
treed6259b51f22216ec77d608fbaf47d08da07da4f8
parent377c9dbabfe6574ff0161f0fd8e750bb57181530 (diff)
downloadrust-fe5c4eab2dbc646f60f748b4b348acf5202ebf59.tar.gz
rust-fe5c4eab2dbc646f60f748b4b348acf5202ebf59.zip
Eliminate a check_stack call on an empty scan stack
-rw-r--r--compiler/rustc_ast_pretty/src/pp.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_ast_pretty/src/pp.rs b/compiler/rustc_ast_pretty/src/pp.rs
index d9832d560a8..21e685fff4a 100644
--- a/compiler/rustc_ast_pretty/src/pp.rs
+++ b/compiler/rustc_ast_pretty/src/pp.rs
@@ -315,8 +315,8 @@ impl Printer {
         } else {
             self.right += 1;
             self.buf.advance_right();
+            self.check_stack(0);
         }
-        self.check_stack(0);
         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;