-
Notifications
You must be signed in to change notification settings - Fork 969
Open
Labels
A-binopArea: binary operatorsArea: binary operatorsI-poor-formattingIssue: poor formattingIssue: poor formattingP-lowLow priorityLow priorityonly-with-optionRequires a non-default option value to reproduceRequires a non-default option value to reproduce
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
workingjubilee
Metadata
Metadata
Assignees
Labels
A-binopArea: binary operatorsArea: binary operatorsI-poor-formattingIssue: poor formattingIssue: poor formattingP-lowLow priorityLow priorityonly-with-optionRequires a non-default option value to reproduceRequires a non-default option value to reproduce