mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
Inline Printer's scan_push method
This commit is contained in:
parent
fdb95f54e8
commit
e219b2b5f9
@ -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()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user