parent
b3a4ba570e
commit
f4952d3780
2 changed files with 9 additions and 2 deletions
|
@ -352,6 +352,8 @@ create_config! {
|
|||
fn_args_layout: IndentStyle, IndentStyle::Visual,
|
||||
"Layout of function arguments and tuple structs";
|
||||
array_layout: IndentStyle, IndentStyle::Visual, "Indent on arrays";
|
||||
array_width: usize, 60,
|
||||
"Maximum width of an array literal before falling back to vertical formatting";
|
||||
type_punctuation_density: TypeDensity, TypeDensity::Wide,
|
||||
"Determines if '+' or '=' are wrapped in spaces in the punctuation of types";
|
||||
where_style: Style, Style::Default, "Overall strategy for where clauses";
|
||||
|
|
|
@ -377,13 +377,18 @@ pub fn rewrite_array<'a, I>(expr_iter: I,
|
|||
IndentStyle::Block => {
|
||||
// FIXME wrong shape in one-line case
|
||||
match shape.width.checked_sub(2 * bracket_size) {
|
||||
Some(width) => definitive_tactic(&items, ListTactic::HorizontalVertical, width),
|
||||
Some(width) => {
|
||||
let tactic = ListTactic::LimitedHorizontalVertical(context.config.array_width);
|
||||
definitive_tactic(&items, tactic, width)
|
||||
}
|
||||
None => DefinitiveListTactic::Vertical,
|
||||
}
|
||||
}
|
||||
IndentStyle::Visual => {
|
||||
if has_long_item || items.iter().any(ListItem::is_multiline) {
|
||||
definitive_tactic(&items, ListTactic::HorizontalVertical, nested_shape.width)
|
||||
definitive_tactic(&items,
|
||||
ListTactic::LimitedHorizontalVertical(context.config.array_width),
|
||||
nested_shape.width)
|
||||
} else {
|
||||
DefinitiveListTactic::Mixed
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue