Merge pull request #864 from Venti-/fn-density

Add option for vertical function argument list
This commit is contained in:
Marcus Klaas de Vries 2016-03-22 10:14:04 +01:00
commit ca757183fe
6 changed files with 129 additions and 1 deletions

View file

@ -71,6 +71,8 @@ configuration_option_enum! { Density:
Tall,
// Try to compress if the body is empty.
CompressedIfEmpty,
// Place every item on a separate line.
Vertical,
}
configuration_option_enum! { TypeDensity:
@ -85,6 +87,7 @@ impl Density {
match self {
Density::Compressed => ListTactic::Mixed,
Density::Tall | Density::CompressedIfEmpty => ListTactic::HorizontalVertical,
Density::Vertical => ListTactic::Vertical,
}
}
}

View file

@ -1544,13 +1544,18 @@ fn rewrite_args(context: &RewriteContext,
_ => multi_line_budget,
};
let end_with_newline = match context.config.fn_args_layout {
StructLitStyle::Block => true,
_ => false,
};
let fmt = ListFormatting {
tactic: tactic,
separator: ",",
trailing_separator: SeparatorTactic::Never,
indent: indent,
width: budget,
ends_with_newline: false,
ends_with_newline: end_with_newline,
config: context.config,
};