diff --git a/src/config.rs b/src/config.rs index 508b569232be..892b90b117ed 100644 --- a/src/config.rs +++ b/src/config.rs @@ -333,6 +333,7 @@ create_config! { via the --file-lines option"; max_width: usize, 100, "Maximum width of each line"; ideal_width: usize, 80, "Ideal width of each line"; + error_on_line_overflow: bool, true, "Error if unable to get all lines within max_width"; tab_spaces: usize, 4, "Number of spaces per tab"; fn_call_width: usize, 60, "Maximum width of the args of a function call before falling back to vertical formatting"; diff --git a/src/lib.rs b/src/lib.rs index abe9a6e8554e..4fdc9ff8675d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -399,7 +399,7 @@ fn format_lines(text: &mut StringBuffer, name: &str, config: &Config, report: &m line_len -= b - lw; } // Check for any line width errors we couldn't correct. - if line_len > config.max_width { + if config.error_on_line_overflow && line_len > config.max_width { errors.push(FormattingError { line: cur_line, kind: ErrorKind::LineOverflow(line_len, config.max_width),