We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 67259e7 commit 6db97b3Copy full SHA for 6db97b3
compiler/rustc_ast_pretty/src/pp.rs
@@ -136,6 +136,7 @@ mod ring;
136
137
use ring::RingBuffer;
138
use std::borrow::Cow;
139
+use std::cmp;
140
use std::collections::VecDeque;
141
use std::iter;
142
@@ -201,6 +202,8 @@ const SIZE_INFINITY: isize = 0xffff;
201
202
203
/// Target line width.
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;
207
208
pub struct Printer {
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;
- self.space = MARGIN - indent;
426
+ self.space = cmp::max(MARGIN - indent, MIN_SPACE);
427
}
428
429
0 commit comments