File tree Expand file tree Collapse file tree 2 files changed +4
-9
lines changed Expand file tree Collapse file tree 2 files changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -154,16 +154,15 @@ impl Printer {
154
154
self . left_total = 1 ;
155
155
self . right_total = 1 ;
156
156
self . right = self . left ;
157
- self . buf . truncate ( 1 ) ;
157
+ self . buf . clear ( ) ;
158
158
} else {
159
+ self . check_stack ( 0 ) ;
159
160
self . right += 1 ;
160
- self . buf . advance_right ( ) ;
161
161
}
162
- self . check_stack ( 0 ) ;
163
- self . buf [ self . right ] = BufEntry {
162
+ self . buf . push ( BufEntry {
164
163
token : Token :: Break ( b) ,
165
164
size : -self . right_total ,
166
- } ;
165
+ } ) ;
167
166
self . scan_stack . push_back ( self . right ) ;
168
167
self . right_total += b. blank_space ;
169
168
}
Original file line number Diff line number Diff line change @@ -34,10 +34,6 @@ impl<T> RingBuffer<T> {
34
34
pub fn clear ( & mut self ) {
35
35
self . data . clear ( ) ;
36
36
}
37
-
38
- pub fn truncate ( & mut self , len : usize ) {
39
- self . data . truncate ( len) ;
40
- }
41
37
}
42
38
43
39
impl < T > Index < usize > for RingBuffer < T > {
You can’t perform that action at this time.
0 commit comments