Added where_trailing_comma option.

The default is 'false', since a lot of the time there's only a single
predicate.
This commit is contained in:
Jeremy Wazny
2016-01-26 12:42:11 +11:00
parent 81516fe8ca
commit d82d3b2cd1
3 changed files with 3 additions and 1 deletions
+1
View File
@@ -316,6 +316,7 @@ fn default() -> Config {
where_layout: ListTactic, ListTactic::Vertical, "Element layout inside a where clause";
where_pred_indent: BlockIndentStyle, BlockIndentStyle::Visual,
"Indentation style of a where predicate";
where_trailing_comma: bool, false, "Put a trailing comma on where clauses";
generics_indent: BlockIndentStyle, BlockIndentStyle::Visual, "Indentation of generics";
struct_trailing_comma: SeparatorTactic, SeparatorTactic::Vertical,
"If there is a trailing comma on structs";
+1 -1
View File
@@ -1530,7 +1530,7 @@ fn rewrite_where_clause(context: &RewriteContext,
let fmt = ListFormatting {
tactic: tactic,
separator: ",",
trailing_separator: SeparatorTactic::Never,
trailing_separator: SeparatorTactic::from_bool(context.config.where_trailing_comma),
indent: offset,
width: budget,
ends_with_newline: true,
+1
View File
@@ -12,6 +12,7 @@ where_density = "Tall"
where_indent = "Tabbed"
where_layout = "Vertical"
where_pred_indent = "Visual"
where_trailing_comma = false
generics_indent = "Visual"
struct_trailing_comma = "Vertical"
struct_lit_trailing_comma = "Vertical"