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
Related to #6060 and #6044. For the below snippet, rustfmt does nothing at all:
enumFoo{A,B,C,D,}fnmain(){let foo = Foo::A;match foo {// Here is a commentFoo::A |
// And another oneFoo::B |
// Hey look! There's another oneFoo::C |
// That's a lot of commentsFoo::D => {}}}
If someone more knowledgeable about rustfmt internals can please confirm that this is a solvable bug, I'd be happy to contribute the fix.
The text was updated successfully, but these errors were encountered:
When you try formatting this with error_on_unformatted=true configured, you'll get the following error message:
error[internal]: not formatted because a comment would be lost
--> <stdin>:10
|
10 | match foo {
|
= note: set `error_on_unformatted = false` to suppress the warning against comments or string literals
rustfmt isn't expecting to find comments within the OR pattern and would remove them if the code was formatted.
I'm not sure how simple this would be to solve. We usually use itemize_list to handle formatting lists of things internally, which takes care of rewriting comments as well.
It might be as simple as defining items (line 100) using itemize_list instead of mapping over the pat_strs, but I haven't looked into this.
Related to #6060 and #6044. For the below snippet, rustfmt does nothing at all:
If someone more knowledgeable about rustfmt internals can please confirm that this is a solvable bug, I'd be happy to contribute the fix.
The text was updated successfully, but these errors were encountered: