mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
Inline indent function
This commit is contained in:
parent
9e794d7de3
commit
224536f4fe
@ -366,12 +366,7 @@ impl Printer {
|
|||||||
|
|
||||||
fn print_newline(&mut self, amount: isize) {
|
fn print_newline(&mut self, amount: isize) {
|
||||||
self.out.push('\n');
|
self.out.push('\n');
|
||||||
self.pending_indentation = 0;
|
self.pending_indentation = amount;
|
||||||
self.indent(amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn indent(&mut self, amount: isize) {
|
|
||||||
self.pending_indentation += amount;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_top(&self) -> PrintFrame {
|
fn get_top(&self) -> PrintFrame {
|
||||||
@ -397,7 +392,7 @@ impl Printer {
|
|||||||
fn print_break(&mut self, token: BreakToken, size: isize) {
|
fn print_break(&mut self, token: BreakToken, size: isize) {
|
||||||
match self.get_top() {
|
match self.get_top() {
|
||||||
PrintFrame::Fits => {
|
PrintFrame::Fits => {
|
||||||
self.indent(token.blank_space);
|
self.pending_indentation += token.blank_space;
|
||||||
self.space -= token.blank_space;
|
self.space -= token.blank_space;
|
||||||
}
|
}
|
||||||
PrintFrame::Broken { offset, breaks: Breaks::Consistent } => {
|
PrintFrame::Broken { offset, breaks: Breaks::Consistent } => {
|
||||||
@ -409,7 +404,7 @@ impl Printer {
|
|||||||
self.print_newline(offset + token.offset);
|
self.print_newline(offset + token.offset);
|
||||||
self.space = self.margin - (offset + token.offset);
|
self.space = self.margin - (offset + token.offset);
|
||||||
} else {
|
} else {
|
||||||
self.indent(token.blank_space);
|
self.pending_indentation += token.blank_space;
|
||||||
self.space -= token.blank_space;
|
self.space -= token.blank_space;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user