Disallow single line chain when the line exceeds the given budget

This commit is contained in:
topecongiro 2017-05-25 09:32:14 +09:00
parent 857747c9ca
commit 6aed417738

View File

@ -181,7 +181,8 @@ pub fn rewrite_chain(expr: &ast::Expr, context: &RewriteContext, shape: Shape) -
let one_line_len = rewrites.iter().fold(0, |a, r| a + first_line_width(r)) + let one_line_len = rewrites.iter().fold(0, |a, r| a + first_line_width(r)) +
parent_rewrite.len(); parent_rewrite.len();
let veto_single_line = if one_line_len > context.config.chain_one_line_max() { let veto_single_line = if one_line_len > context.config.chain_one_line_max() ||
one_line_len > shape.width {
if rewrites.len() > 1 { if rewrites.len() > 1 {
true true
} else if rewrites.len() == 1 { } else if rewrites.len() == 1 {