@@ -199,10 +199,11 @@ enum PrintFrame {
199
199
200
200
const SIZE_INFINITY : isize = 0xffff ;
201
201
202
+ /// Target line width.
203
+ const MARGIN : isize = 78 ;
204
+
202
205
pub struct Printer {
203
206
out : String ,
204
- /// Width of lines we're constrained to
205
- margin : isize ,
206
207
/// Number of spaces left on line
207
208
space : isize ,
208
209
/// Ring-buffer of tokens and calculated sizes
@@ -237,11 +238,9 @@ struct BufEntry {
237
238
238
239
impl Printer {
239
240
pub fn new ( ) -> Self {
240
- let linewidth = 78 ;
241
241
Printer {
242
242
out : String :: new ( ) ,
243
- margin : linewidth as isize ,
244
- space : linewidth as isize ,
243
+ space : MARGIN ,
245
244
buf : RingBuffer :: new ( ) ,
246
245
left_total : 0 ,
247
246
right_total : 0 ,
@@ -395,7 +394,7 @@ impl Printer {
395
394
self . print_stack . push ( PrintFrame :: Broken { indent : self . indent , breaks : token. breaks } ) ;
396
395
self . indent = match token. indent {
397
396
IndentStyle :: Block { offset } => ( self . indent as isize + offset) as usize ,
398
- IndentStyle :: Visual => ( self . margin - self . space ) as usize ,
397
+ IndentStyle :: Visual => ( MARGIN - self . space ) as usize ,
399
398
} ;
400
399
} else {
401
400
self . print_stack . push ( PrintFrame :: Fits ) ;
@@ -421,7 +420,7 @@ impl Printer {
421
420
self . out . push ( '\n' ) ;
422
421
let indent = self . indent as isize + token. offset ;
423
422
self . pending_indentation = indent;
424
- self . space = self . margin - indent;
423
+ self . space = MARGIN - indent;
425
424
}
426
425
}
427
426
0 commit comments