File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
compiler/rustc_ast_pretty/src Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -136,6 +136,7 @@ mod ring;
136136
137137use ring:: RingBuffer ;
138138use std:: borrow:: Cow ;
139+ use std:: cmp;
139140use std:: collections:: VecDeque ;
140141use std:: iter;
141142
@@ -201,6 +202,8 @@ const SIZE_INFINITY: isize = 0xffff;
201202
202203/// Target line width.
203204const MARGIN : isize = 78 ;
205+ /// Every line is allowed at least this much space, even if highly indented.
206+ const MIN_SPACE : isize = 60 ;
204207
205208pub struct Printer {
206209 out : String ,
@@ -420,7 +423,7 @@ impl Printer {
420423 self . out . push ( '\n' ) ;
421424 let indent = self . indent as isize + token. offset ;
422425 self . pending_indentation = indent;
423- self . space = MARGIN - indent;
426+ self . space = cmp :: max ( MARGIN - indent, MIN_SPACE ) ;
424427 }
425428 }
426429
You can’t perform that action at this time.
0 commit comments