Add error_on_line_overflow option

Makes it configurable whether to error if unable to get all lines within
the max_width.
This commit is contained in:
Sebastian Blunt 2017-02-19 19:56:37 +01:00
parent 4f939ddf0c
commit f6ccbd71c3
No known key found for this signature in database
GPG key ID: 5AD353DE058346B1
2 changed files with 2 additions and 1 deletions

View file

@ -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";

View file

@ -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),