diff --git a/src/config.rs b/src/config.rs index 5b6a5e05cf59..48b7a06e538e 100644 --- a/src/config.rs +++ b/src/config.rs @@ -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"; diff --git a/src/items.rs b/src/items.rs index 1e1b6ca8076d..f725ccf0153f 100644 --- a/src/items.rs +++ b/src/items.rs @@ -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, diff --git a/tests/config/small_tabs.toml b/tests/config/small_tabs.toml index 1681aff77b4b..cb4d5da52748 100644 --- a/tests/config/small_tabs.toml +++ b/tests/config/small_tabs.toml @@ -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"