Closed as not planned
Description
TLDR:
// single line expected; got multi line
fn is_zero(n: i32) -> bool {
if n == 0 {
true
} else {
false
}
}
To reproduce:
Create a new cargo project with default rustfmt settings, paste in this function, and format document.
Expected:
fn is_zero(n: i32) -> bool {
if n == 0 { true } else { false }
}
Actual:
fn is_zero(n: i32) -> bool {
if n == 0 {
true
} else {
false
}
}
Misc:
Adding explicit return
triggers single line mode, which shows it's not related to single_line_if_else_max_width
:
fn is_zero(n: i32) -> bool {
return if n == 0 { true } else { false };
}
Versions:
rustfmt 1.5.1-stable (897e375 2022-11-02) on Linux 6.0.6 x86_64
Metadata
Metadata
Assignees
Labels
No labels