Merge pull request from topecongiro/poor-formatting/if-else

Remove visual_indent when rewriting else block
This commit is contained in:
Nick Cameron 2017-05-09 15:21:29 +12:00 committed by GitHub
commit 35e1ca73fc
3 changed files with 24 additions and 2 deletions

@ -1004,7 +1004,7 @@ impl<'a> Rewrite for ControlFlow<'a> {
false,
true,
mk_sp(else_block.span.lo, self.span.hi))
.rewrite(context, shape.visual_indent(0))
.rewrite(context, shape)
}
ast::ExprKind::If(ref cond, ref if_block, ref next_else_block) => {
ControlFlow::new_if(cond,
@ -1014,7 +1014,7 @@ impl<'a> Rewrite for ControlFlow<'a> {
false,
true,
mk_sp(else_block.span.lo, self.span.hi))
.rewrite(context, shape.visual_indent(0))
.rewrite(context, shape)
}
_ => {
last_in_chain = true;

@ -0,0 +1,11 @@
fn issue1518() {
Some(Object {
field: if a {
a_thing
} else if b {
b_thing
} else {
c_thing
},
})
}

@ -0,0 +1,11 @@
fn issue1518() {
Some(Object {
field: if a {
a_thing
} else if b {
b_thing
} else {
c_thing
},
})
}