mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-06 05:33:59 +00:00
Compress an array with simple items
This commit is contained in:
parent
8cf99b1d90
commit
1684df6a0a
@ -501,7 +501,7 @@ fn array_tactic<T: Rewrite + Spanned + ToExpr>(
|
||||
|
||||
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<T: Rewrite + Spanned + ToExpr>(
|
||||
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 => {
|
||||
|
Loading…
Reference in New Issue
Block a user