mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
Simplify left_total tracking
This commit is contained in:
parent
d981c5b354
commit
351011ec3f
@ -321,20 +321,14 @@ impl Printer {
|
|||||||
while left_size >= 0 {
|
while left_size >= 0 {
|
||||||
let left = self.buf.pop_first().unwrap().token;
|
let left = self.buf.pop_first().unwrap().token;
|
||||||
|
|
||||||
let len = match left {
|
match &left {
|
||||||
Token::Break(b) => b.blank_space,
|
Token::Break(b) => self.left_total += b.blank_space,
|
||||||
Token::String(ref s) => {
|
Token::String(s) => self.left_total += s.len() as isize,
|
||||||
let len = s.len() as isize;
|
_ => {}
|
||||||
assert_eq!(len, left_size);
|
}
|
||||||
len
|
|
||||||
}
|
|
||||||
_ => 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
self.print(left, left_size);
|
self.print(left, left_size);
|
||||||
|
|
||||||
self.left_total += len;
|
|
||||||
|
|
||||||
if self.buf.is_empty() {
|
if self.buf.is_empty() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -447,11 +441,7 @@ impl Printer {
|
|||||||
Token::Begin(b) => self.print_begin(*b, l),
|
Token::Begin(b) => self.print_begin(*b, l),
|
||||||
Token::End => self.print_end(),
|
Token::End => self.print_end(),
|
||||||
Token::Break(b) => self.print_break(*b, l),
|
Token::Break(b) => self.print_break(*b, l),
|
||||||
Token::String(s) => {
|
Token::String(s) => self.print_string(s),
|
||||||
let len = s.len() as isize;
|
|
||||||
assert_eq!(len, l);
|
|
||||||
self.print_string(s);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
self.last_printed = Some(token);
|
self.last_printed = Some(token);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user