Simplify the buffer push done by scan_break
This commit is contained in:
parent
fe5c4eab2d
commit
6e8b06015e
2 changed files with 3 additions and 8 deletions
|
@ -311,13 +311,12 @@ impl Printer {
|
|||
self.left_total = 1;
|
||||
self.right_total = 1;
|
||||
self.right = self.left;
|
||||
self.buf.truncate(1);
|
||||
self.buf.clear();
|
||||
} else {
|
||||
self.right += 1;
|
||||
self.buf.advance_right();
|
||||
self.check_stack(0);
|
||||
self.right += 1;
|
||||
}
|
||||
self.buf[self.right] = BufEntry { token: Token::Break(b), size: -self.right_total };
|
||||
self.buf.push(BufEntry { token: Token::Break(b), size: -self.right_total });
|
||||
self.scan_stack.push_front(self.right);
|
||||
self.right_total += b.blank_space;
|
||||
}
|
||||
|
|
|
@ -41,10 +41,6 @@ impl<T> RingBuffer<T> {
|
|||
pub fn clear(&mut self) {
|
||||
self.data.clear();
|
||||
}
|
||||
|
||||
pub fn truncate(&mut self, len: usize) {
|
||||
self.data.truncate(len);
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Index<usize> for RingBuffer<T> {
|
||||
|
|
Loading…
Add table
Reference in a new issue