Allow overflowing the last item of chain only if it is multi-lined

By multi-lined we mean if it has more than 3 lines.
This commit is contained in:
topecongiro 2017-06-16 08:47:33 +09:00
parent 02c1996e3e
commit d3d31a9f75

View File

@ -348,7 +348,7 @@ fn rewrite_last_child_with_overflow(
) -> bool {
if let Some(shape) = shape.shrink_left(almost_total) {
if let Some(ref mut rw) = rewrite_chain_subexpr(expr, span, context, shape) {
if almost_total + first_line_width(rw) <= one_line_budget {
if almost_total + first_line_width(rw) <= one_line_budget && rw.lines().count() > 3 {
::std::mem::swap(last_child, rw);
return true;
}