You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Why even move the comment? Having the explanation for the conditional on the same line as the conditional is perfectly fine, very readable and can help save some vertical space.
If rustfmt for some reason must move the comment, it should be moved up. The comment was explaining the if true, and a comment explaining something should not come after the thing already happened! Currently, rustfmt actively degrades the quality of such comments. The reformatted code looks like the comment is explaining the println!.
I am very worried now how many such comments that were in the compiler are wrong / confusing now because of this. :/
The text was updated successfully, but these errors were encountered:
Agreed, though I think this is a duplicate of #3255.
I think rustfmt is assuming the same-line comment after the opening { is associated to the first statement in the block, instead of the control flow expression condition, which is why the comment is moved and indented with that first statement
For some reason, rustfmt arbitrarily decides to move the comment around in the following snippet:
(I am saying "arbitrarily" as this page has no explanation for why this happens)
This becomes:
This is bad for 2 reasons:
if true
, and a comment explaining something should not come after the thing already happened! Currently, rustfmt actively degrades the quality of such comments. The reformatted code looks like the comment is explaining theprintln!
.I am very worried now how many such comments that were in the compiler are wrong / confusing now because of this. :/
The text was updated successfully, but these errors were encountered: