Inline Printer's scan_pop method

This commit is contained in:
David Tolnay 2022-01-18 19:15:02 -08:00
parent 50d722a691
commit e20d5abdfb
No known key found for this signature in database
GPG key ID: F9BA143B95FF6D82

View file

@ -347,10 +347,6 @@ impl Printer {
}
}
fn scan_pop(&mut self) -> usize {
self.scan_stack.pop_front().unwrap()
}
fn scan_top(&self) -> usize {
*self.scan_stack.front().unwrap()
}
@ -396,19 +392,19 @@ impl Printer {
match self.buf[x].token {
Token::Begin(_) => {
if k > 0 {
self.scan_pop();
self.scan_stack.pop_front().unwrap();
self.buf[x].size += self.right_total;
self.check_stack(k - 1);
}
}
Token::End => {
// paper says + not =, but that makes no sense.
self.scan_pop();
self.scan_stack.pop_front().unwrap();
self.buf[x].size = 1;
self.check_stack(k + 1);
}
_ => {
self.scan_pop();
self.scan_stack.pop_front().unwrap();
self.buf[x].size += self.right_total;
if k > 0 {
self.check_stack(k);