From 86be2e7bf85bd2c052b2d10c23fb6d4f5fe1424f Mon Sep 17 00:00:00 2001 From: topecongiro Date: Mon, 5 Jun 2017 17:57:43 +0900 Subject: [PATCH] Do not add offset to match pattern when using Rfc style --- src/expr.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/expr.rs b/src/expr.rs index 16dfe6fcaa6..ebf5c519fac 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -1205,8 +1205,10 @@ fn rewrite_match(context: &RewriteContext, } // `match `cond` {` - let cond_shape = try_opt!(shape.shrink_left(6)); - let cond_shape = try_opt!(cond_shape.sub_width(2)); + let cond_shape = match context.config.control_style() { + Style::Legacy => try_opt!(shape.shrink_left(6).and_then(|s| s.sub_width(2))), + Style::Rfc => try_opt!(shape.sub_width(8)), + }; let cond_str = try_opt!(cond.rewrite(context, cond_shape)); let alt_block_sep = String::from("\n") + &shape.indent.block_only().to_string(context.config); let block_sep = match context.config.control_brace_style() {