diff options
| author | David Tolnay <dtolnay@gmail.com> | 2022-01-19 18:56:12 -0800 |
|---|---|---|
| committer | David Tolnay <dtolnay@gmail.com> | 2022-01-19 19:04:35 -0800 |
| commit | 51eeb82d9db71bfb90ed6e0149d032787bcb3ee6 (patch) | |
| tree | 44eea7b0fb32ef311c93c7616a280bde7adc20db | |
| parent | 224536f4fee75a9825e7da0a8a332786cc1f52f8 (diff) | |
| download | rust-51eeb82d9db71bfb90ed6e0149d032787bcb3ee6.tar.gz rust-51eeb82d9db71bfb90ed6e0149d032787bcb3ee6.zip | |
Inline print_newline function
| -rw-r--r-- | compiler/rustc_ast_pretty/src/pp.rs | 11 |
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; |
