Skip to content

Commit 1684df6

Browse files
committed
Compress an array with simple items
1 parent 8cf99b1 commit 1684df6

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/expr.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,14 +501,21 @@ fn array_tactic<T: Rewrite + Spanned + ToExpr>(
501501

502502
match context.config.indent_style() {
503503
IndentStyle::Block => {
504-
match shape.width.checked_sub(2 * bracket_size) {
504+
let tactic = match shape.width.checked_sub(2 * bracket_size) {
505505
Some(width) => {
506506
let tactic = ListTactic::LimitedHorizontalVertical(
507507
context.config.width_heuristics().array_width,
508508
);
509509
definitive_tactic(items, tactic, Separator::Comma, width)
510510
}
511511
None => DefinitiveListTactic::Vertical,
512+
};
513+
if tactic == DefinitiveListTactic::Vertical && !has_long_item
514+
&& is_every_args_simple(exprs)
515+
{
516+
DefinitiveListTactic::Mixed
517+
} else {
518+
tactic
512519
}
513520
}
514521
IndentStyle::Visual => {

0 commit comments

Comments
 (0)