Skip to content

Commit 6db97b3

Browse files
committed
Allow any line to have at least 60 chars
1 parent 67259e7 commit 6db97b3

File tree

1 file changed

+4
-1
lines changed
  • compiler/rustc_ast_pretty/src

1 file changed

+4
-1
lines changed

compiler/rustc_ast_pretty/src/pp.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ mod ring;
136136

137137
use ring::RingBuffer;
138138
use std::borrow::Cow;
139+
use std::cmp;
139140
use std::collections::VecDeque;
140141
use std::iter;
141142

@@ -201,6 +202,8 @@ const SIZE_INFINITY: isize = 0xffff;
201202

202203
/// Target line width.
203204
const MARGIN: isize = 78;
205+
/// Every line is allowed at least this much space, even if highly indented.
206+
const MIN_SPACE: isize = 60;
204207

205208
pub 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

0 commit comments

Comments
 (0)