diff options
| author | David Tolnay <dtolnay@gmail.com> | 2022-01-19 18:39:38 -0800 |
|---|---|---|
| committer | David Tolnay <dtolnay@gmail.com> | 2022-01-19 19:04:30 -0800 |
| commit | ae75ba692a456216139abe42e88b4ca45b973127 (patch) | |
| tree | 614497748f263d287fbbb69f0763a5d70f84772c | |
| parent | d2eb46cfecf62210ee313da76acadedd7a2cbfcb (diff) | |
Inline print into advance_left
| -rw-r--r-- | compiler/rustc_ast_pretty/src/pp.rs | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/compiler/rustc_ast_pretty/src/pp.rs b/compiler/rustc_ast_pretty/src/pp.rs index 2c7962e44d0..1a6a7f2c52a 100644 --- a/compiler/rustc_ast_pretty/src/pp.rs +++ b/compiler/rustc_ast_pretty/src/pp.rs @@ -325,7 +325,14 @@ impl Printer { _ => {} } - self.print(left.token, left.size); + match &left.token { + Token::Begin(b) => self.print_begin(*b, left.size), + Token::End => self.print_end(), + Token::Break(b) => self.print_break(*b, left.size), + Token::String(s) => self.print_string(s), + } + + self.last_printed = Some(left.token); if self.buf.is_empty() { break; @@ -432,16 +439,6 @@ impl Printer { self.out.push_str(s); } - fn print(&mut self, token: Token, l: isize) { - match &token { - Token::Begin(b) => self.print_begin(*b, l), - Token::End => self.print_end(), - Token::Break(b) => self.print_break(*b, l), - Token::String(s) => self.print_string(s), - } - self.last_printed = Some(token); - } - // Convenience functions to talk to the printer. /// "raw box" |
