about summary refs log tree commit diff
path: root/src/expr.rs
diff options
context:
space:
mode:
authorNick Cameron <ncameron@mozilla.com>2017-03-02 14:27:02 +1300
committerNick Cameron <ncameron@mozilla.com>2017-03-02 14:27:02 +1300
commit248f2aba56d12958d4c42c2fd38347a849564280 (patch)
tree24c51d7020722f1bf4f240db76daaa497bb6cb92 /src/expr.rs
parentfbb2370d66e35029e6e6545f12831d591b1e0cae (diff)
parentb8da53ad7865a813e5862fb2de7e839d41af27b3 (diff)
Merge branch 'master' of github.com:rust-lang-nursery/rustfmt
Diffstat (limited to 'src/expr.rs')
-rw-r--r--src/expr.rs30
1 files changed, 21 insertions, 9 deletions
diff --git a/src/expr.rs b/src/expr.rs
index cbec7d0a8af..83f6e1f22c7 100644
--- a/src/expr.rs
+++ b/src/expr.rs
@@ -1287,21 +1287,33 @@ impl Rewrite for ast::Arm {
                 ("{", "}")
             }
         } else {
-            ("", "")
+            ("", ",")
         };
 
+
         let block_sep = match context.config.control_brace_style {
             ControlBraceStyle::AlwaysNextLine => alt_block_sep + body_prefix + "\n",
             _ => String::from(" ") + body_prefix + "\n",
         };
-        Some(format!("{}{} =>{}{}{}\n{}{}",
-                     attr_str.trim_left(),
-                     pats_str,
-                     block_sep,
-                     indent_str,
-                     next_line_body,
-                     shape.indent.to_string(context.config),
-                     body_suffix))
+
+        if context.config.wrap_match_arms {
+            Some(format!("{}{} =>{}{}{}\n{}{}",
+                         attr_str.trim_left(),
+                         pats_str,
+                         block_sep,
+                         indent_str,
+                         next_line_body,
+                         shape.indent.to_string(context.config),
+                         body_suffix))
+        } else {
+            Some(format!("{}{} =>{}{}{}{}",
+                         attr_str.trim_left(),
+                         pats_str,
+                         block_sep,
+                         indent_str,
+                         next_line_body,
+                         body_suffix))
+        }
     }
 }