@@ -222,13 +222,13 @@ fn buf_str(buf: &[BufEntry], left: usize, right: usize, lim: usize) -> String {
222
222
}
223
223
224
224
#[ derive( Copy , Clone ) ]
225
- crate enum PrintStackBreak {
225
+ enum PrintStackBreak {
226
226
Fits ,
227
227
Broken ( Breaks ) ,
228
228
}
229
229
230
230
#[ derive( Copy , Clone ) ]
231
- crate struct PrintStackElem {
231
+ struct PrintStackElem {
232
232
offset : isize ,
233
233
pbreak : PrintStackBreak
234
234
}
@@ -380,7 +380,7 @@ impl Printer {
380
380
}
381
381
}
382
382
383
- crate fn check_stream ( & mut self ) {
383
+ fn check_stream ( & mut self ) {
384
384
debug ! ( "check_stream Vec<{}, {}> with left_total={}, right_total={}" ,
385
385
self . left, self . right, self . left_total, self . right_total) ;
386
386
if self . right_total - self . left_total > self . space {
@@ -398,24 +398,24 @@ impl Printer {
398
398
}
399
399
}
400
400
401
- crate fn scan_push ( & mut self , x : usize ) {
401
+ fn scan_push ( & mut self , x : usize ) {
402
402
debug ! ( "scan_push {}" , x) ;
403
403
self . scan_stack . push_front ( x) ;
404
404
}
405
405
406
- crate fn scan_pop ( & mut self ) -> usize {
406
+ fn scan_pop ( & mut self ) -> usize {
407
407
self . scan_stack . pop_front ( ) . unwrap ( )
408
408
}
409
409
410
- crate fn scan_top ( & mut self ) -> usize {
410
+ fn scan_top ( & mut self ) -> usize {
411
411
* self . scan_stack . front ( ) . unwrap ( )
412
412
}
413
413
414
- crate fn scan_pop_bottom ( & mut self ) -> usize {
414
+ fn scan_pop_bottom ( & mut self ) -> usize {
415
415
self . scan_stack . pop_back ( ) . unwrap ( )
416
416
}
417
417
418
- crate fn advance_right ( & mut self ) {
418
+ fn advance_right ( & mut self ) {
419
419
self . right += 1 ;
420
420
self . right %= self . buf_max_len ;
421
421
// Extend the buf if necessary.
@@ -425,7 +425,7 @@ impl Printer {
425
425
assert_ne ! ( self . right, self . left) ;
426
426
}
427
427
428
- crate fn advance_left ( & mut self ) {
428
+ fn advance_left ( & mut self ) {
429
429
debug ! ( "advance_left Vec<{},{}>, sizeof({})={}" , self . left, self . right,
430
430
self . left, self . buf[ self . left] . size) ;
431
431
@@ -458,7 +458,7 @@ impl Printer {
458
458
}
459
459
}
460
460
461
- crate fn check_stack ( & mut self , k : isize ) {
461
+ fn check_stack ( & mut self , k : isize ) {
462
462
if !self . scan_stack . is_empty ( ) {
463
463
let x = self . scan_top ( ) ;
464
464
match self . buf [ x] . token {
@@ -486,19 +486,19 @@ impl Printer {
486
486
}
487
487
}
488
488
489
- crate fn print_newline ( & mut self , amount : isize ) {
489
+ fn print_newline ( & mut self , amount : isize ) {
490
490
debug ! ( "NEWLINE {}" , amount) ;
491
491
self . out . push ( '\n' ) ;
492
492
self . pending_indentation = 0 ;
493
493
self . indent ( amount) ;
494
494
}
495
495
496
- crate fn indent ( & mut self , amount : isize ) {
496
+ fn indent ( & mut self , amount : isize ) {
497
497
debug ! ( "INDENT {}" , amount) ;
498
498
self . pending_indentation += amount;
499
499
}
500
500
501
- crate fn get_top ( & mut self ) -> PrintStackElem {
501
+ fn get_top ( & mut self ) -> PrintStackElem {
502
502
match self . print_stack . last ( ) {
503
503
Some ( el) => * el,
504
504
None => PrintStackElem {
@@ -508,7 +508,7 @@ impl Printer {
508
508
}
509
509
}
510
510
511
- crate fn print_begin ( & mut self , b : BeginToken , l : isize ) {
511
+ fn print_begin ( & mut self , b : BeginToken , l : isize ) {
512
512
if l > self . space {
513
513
let col = self . margin - self . space + b. offset ;
514
514
debug ! ( "print Begin -> push broken block at col {}" , col) ;
@@ -525,14 +525,14 @@ impl Printer {
525
525
}
526
526
}
527
527
528
- crate fn print_end ( & mut self ) {
528
+ fn print_end ( & mut self ) {
529
529
debug ! ( "print End -> pop End" ) ;
530
530
let print_stack = & mut self . print_stack ;
531
531
assert ! ( !print_stack. is_empty( ) ) ;
532
532
print_stack. pop ( ) . unwrap ( ) ;
533
533
}
534
534
535
- crate fn print_break ( & mut self , b : BreakToken , l : isize ) {
535
+ fn print_break ( & mut self , b : BreakToken , l : isize ) {
536
536
let top = self . get_top ( ) ;
537
537
match top. pbreak {
538
538
PrintStackBreak :: Fits => {
@@ -562,7 +562,7 @@ impl Printer {
562
562
}
563
563
}
564
564
565
- crate fn print_string ( & mut self , s : Cow < ' static , str > , len : isize ) {
565
+ fn print_string ( & mut self , s : Cow < ' static , str > , len : isize ) {
566
566
debug ! ( "print String({})" , s) ;
567
567
// assert!(len <= space);
568
568
self . space -= len;
@@ -579,7 +579,7 @@ impl Printer {
579
579
self . out . push_str ( & s) ;
580
580
}
581
581
582
- crate fn print ( & mut self , token : Token , l : isize ) {
582
+ fn print ( & mut self , token : Token , l : isize ) {
583
583
debug ! ( "print {} {} (remaining line space={})" , token, l,
584
584
self . space) ;
585
585
debug ! ( "{}" , buf_str( & self . buf,
0 commit comments