Merge pull request #1519 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
3 changed files with 24 additions and 2 deletions
+2 -2
View File
@@ -1004,7 +1004,7 @@ fn rewrite(&self, context: &RewriteContext, shape: Shape) -> Option<String> {
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 @@ fn rewrite(&self, context: &RewriteContext, shape: Shape) -> Option<String> {
false,
true,
mk_sp(else_block.span.lo, self.span.hi))
.rewrite(context, shape.visual_indent(0))
.rewrite(context, shape)
}
_ => {
last_in_chain = true;
+11
View File
@@ -0,0 +1,11 @@
fn issue1518() {
Some(Object {
field: if a {
a_thing
} else if b {
b_thing
} else {
c_thing
},
})
}
+11
View File
@@ -0,0 +1,11 @@
fn issue1518() {
Some(Object {
field: if a {
a_thing
} else if b {
b_thing
} else {
c_thing
},
})
}