File tree 1 file changed +4
-1
lines changed
compiler/rustc_ast_pretty/src
1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -136,6 +136,7 @@ mod ring;
136
136
137
137
use ring:: RingBuffer ;
138
138
use std:: borrow:: Cow ;
139
+ use std:: cmp;
139
140
use std:: collections:: VecDeque ;
140
141
use std:: iter;
141
142
@@ -201,6 +202,8 @@ const SIZE_INFINITY: isize = 0xffff;
201
202
202
203
/// Target line width.
203
204
const MARGIN : isize = 78 ;
205
+ /// Every line is allowed at least this much space, even if highly indented.
206
+ const MIN_SPACE : isize = 60 ;
204
207
205
208
pub struct Printer {
206
209
out : String ,
@@ -420,7 +423,7 @@ impl Printer {
420
423
self . out . push ( '\n' ) ;
421
424
let indent = self . indent as isize + token. offset ;
422
425
self . pending_indentation = indent;
423
- self . space = MARGIN - indent;
426
+ self . space = cmp :: max ( MARGIN - indent, MIN_SPACE ) ;
424
427
}
425
428
}
426
429
You can’t perform that action at this time.
0 commit comments