Merge pull request #1633 from topecongiro/rfc/control-style

Do not add offset to match pattern when using Rfc style
This commit is contained in:
Nick Cameron 2017-06-06 14:54:28 +12:00 committed by GitHub
commit 450631ae67

View file

@ -1207,8 +1207,10 @@ fn rewrite_match(context: &RewriteContext,
} }
// `match `cond` {` // `match `cond` {`
let cond_shape = try_opt!(shape.shrink_left(6)); let cond_shape = match context.config.control_style() {
let cond_shape = try_opt!(cond_shape.sub_width(2)); 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 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 alt_block_sep = String::from("\n") + &shape.indent.block_only().to_string(context.config);
let block_sep = match context.config.control_brace_style() { let block_sep = match context.config.control_brace_style() {