Open
Description
With hard_tabs = true, the formatting of some if/else expressions is shifted one level of indentation to the left. Everything works as expected when hard_tabs = false.
Input
fn main() {
let condition_a = true;
let condition_b = false;
let x = 123.456789
+ if condition_a {
x + y + z + w
} else {
123.456789
}
+ if condition_b {
x - y - z - w
} else {
123.456789
};
}
Output
The issue is the last three lines of the main()
function are indented one level less than expected.
fn main() {
let condition_a = true;
let condition_b = false;
let x = 123.456789
+ if condition_a {
x + y + z + w
} else {
123.456789
} + if condition_b {
x - y - z - w
} else {
123.456789
};
}
Expected output
fn main() {
let condition_a = true;
let condition_b = false;
let x = 123.456789
+ if condition_a {
x + y + z + w
} else {
123.456789
} + if condition_b {
x - y - z - w
} else {
123.456789
};
}
Meta
- rustfmt version: rustfmt 1.4.24-stable (eb894d5 2020-11-05)
- From where did you install rustfmt?: rustup