From 1684df6a0ac5b97a122a8223a8412e6c442bbbfe Mon Sep 17 00:00:00 2001 From: topecongiro Date: Mon, 4 Dec 2017 12:07:06 +0900 Subject: [PATCH] Compress an array with simple items --- src/expr.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/expr.rs b/src/expr.rs index cbfb0f105121..db256c3ba7de 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -501,7 +501,7 @@ fn array_tactic( match context.config.indent_style() { IndentStyle::Block => { - match shape.width.checked_sub(2 * bracket_size) { + let tactic = match shape.width.checked_sub(2 * bracket_size) { Some(width) => { let tactic = ListTactic::LimitedHorizontalVertical( context.config.width_heuristics().array_width, @@ -509,6 +509,13 @@ fn array_tactic( definitive_tactic(items, tactic, Separator::Comma, width) } None => DefinitiveListTactic::Vertical, + }; + if tactic == DefinitiveListTactic::Vertical && !has_long_item + && is_every_args_simple(exprs) + { + DefinitiveListTactic::Mixed + } else { + tactic } } IndentStyle::Visual => {