Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign uprustfmt does not put short if-else at the end of the block #2777
Comments
topecongiro
added
the
poor-formatting
label
Jun 9, 2018
nrc
added this to the 1.0 milestone
Jul 10, 2018
nrc
added
the
p-low
label
Jul 10, 2018
nrc
removed this from the 1.0 (preview 2) milestone
Jul 10, 2018
topecongiro
referenced this issue
Feb 11, 2019
Merged
Format the if expression at the end of the block in a single line #3338
topecongiro
closed this
in
#3338
Mar 11, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
topecongiro commentedJun 9, 2018
•
edited
As of
rustfmt 0.8.2-nightly (08da30d 2018-06-06), rustfmt formats shortifexpressions like the following:This is becuase the
ifinplain_ifis parsed as a statement, whereas others are parsed as an expression (rustfmt rewritesifin a single line only when it apprears in the expression place).