diff options
| author | Nick Cameron <ncameron@mozilla.com> | 2017-03-02 14:27:02 +1300 |
|---|---|---|
| committer | Nick Cameron <ncameron@mozilla.com> | 2017-03-02 14:27:02 +1300 |
| commit | 248f2aba56d12958d4c42c2fd38347a849564280 (patch) | |
| tree | 24c51d7020722f1bf4f240db76daaa497bb6cb92 /src/expr.rs | |
| parent | fbb2370d66e35029e6e6545f12831d591b1e0cae (diff) | |
| parent | b8da53ad7865a813e5862fb2de7e839d41af27b3 (diff) | |
Merge branch 'master' of github.com:rust-lang-nursery/rustfmt
Diffstat (limited to 'src/expr.rs')
| -rw-r--r-- | src/expr.rs | 30 |
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)) + } } } |
