From db9d1290254c5703d67fcf4f277b23641fb92d60 Mon Sep 17 00:00:00 2001 From: Ari Koivula Date: Sun, 13 Mar 2016 22:57:03 +0200 Subject: Add Vertical fn_args_density This adds new option Vertical to fn_args_density, which formats the list vertically no matter what. --- src/config.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/config.rs b/src/config.rs index 448ab3b8d51..32eb9af4b11 100644 --- a/src/config.rs +++ b/src/config.rs @@ -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, } } } -- cgit 1.4.1-3-g733a5 From 0c8640a84f0cf4ce01665aa482f4470edcf12410 Mon Sep 17 00:00:00 2001 From: Ari Koivula Date: Sun, 13 Mar 2016 23:27:13 +0200 Subject: Fix last comment turning into block comment This fixes the comment after the last argument in an argument list being turned into a block comment when it's not necessary. --- src/items.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/items.rs b/src/items.rs index 9e5b964429e..f0a7d94ebe7 100644 --- a/src/items.rs +++ b/src/items.rs @@ -1370,13 +1370,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, }; -- cgit 1.4.1-3-g733a5