Closed cyqsimon closed 2 years ago
Thanks for reaching out.
There was some work done in https://github.com/rust-lang/rustfmt/pull/5509 to expand the docs on single_line_if_else_max_width
.
The explicit return
seems like an interesting case.
tl;dr - duplicate of (primary) item #4351 with more detail in the first half of from https://github.com/rust-lang/rustfmt/issues/4351#issuecomment-663782224. You can set version=Two
to get the desired behavior if you're able to work on nightly, otherwise it's something that just has to be accepted due to the stability guarantees
TLDR:
To reproduce:
Create a new cargo project with default rustfmt settings, paste in this function, and format document.
Expected:
Actual:
Misc:
Adding explicit
return
triggers single line mode, which shows it's not related tosingle_line_if_else_max_width
:Versions:
rustfmt 1.5.1-stable (897e375 2022-11-02) on Linux 6.0.6 x86_64