about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMarcus Klaas de Vries <mail@marcusklaas.nl>2016-03-22 10:14:04 +0100
committerMarcus Klaas de Vries <mail@marcusklaas.nl>2016-03-22 10:14:04 +0100
commitca757183fedf8e89286372b91ca074c11d99c4f4 (patch)
tree0637fd97e554176c2cb6180202f12d57edc830d1 /src
parent4cb043112bb3d4f6212678eb6cf97952f0d68350 (diff)
parent8d299210a6bee1ead0301073c72b5671ce4d8c84 (diff)
Merge pull request #864 from Venti-/fn-density
Add option for vertical function argument list
Diffstat (limited to 'src')
-rw-r--r--src/config.rs3
-rw-r--r--src/items.rs7
2 files changed, 9 insertions, 1 deletions
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,
         }
     }
 }
diff --git a/src/items.rs b/src/items.rs
index b879080d92f..04382489b28 100644
--- a/src/items.rs
+++ b/src/items.rs
@@ -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,
     };