From d3d31a9f75c99fac12beb1341610d806f56c5d31 Mon Sep 17 00:00:00 2001 From: topecongiro Date: Fri, 16 Jun 2017 08:47:33 +0900 Subject: [PATCH] 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. --- src/chains.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chains.rs b/src/chains.rs index 890c39ebabb..7fcd1f3fb3e 100644 --- a/src/chains.rs +++ b/src/chains.rs @@ -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; }