Merge pull request #1519 from topecongiro/poor-formatting/if-else
Remove visual_indent when rewriting else block
This commit is contained in:
commit
35e1ca73fc
@ -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;
|
||||
|
11
tests/source/nested-if-else.rs
Normal file
11
tests/source/nested-if-else.rs
Normal file
@ -0,0 +1,11 @@
|
||||
fn issue1518() {
|
||||
Some(Object {
|
||||
field: if a {
|
||||
a_thing
|
||||
} else if b {
|
||||
b_thing
|
||||
} else {
|
||||
c_thing
|
||||
},
|
||||
})
|
||||
}
|
11
tests/target/nested-if-else.rs
Normal file
11
tests/target/nested-if-else.rs
Normal file
@ -0,0 +1,11 @@
|
||||
fn issue1518() {
|
||||
Some(Object {
|
||||
field: if a {
|
||||
a_thing
|
||||
} else if b {
|
||||
b_thing
|
||||
} else {
|
||||
c_thing
|
||||
},
|
||||
})
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user