Rustfmt loses comments in variants between the name and the discriminant
Open
@HarrisonHemstreet is already working on this.
Since Jun 29, 2023.
A-comments
C-bug
I-unexpectedly-removes-code
P-low
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 24
Description
Consider this code that I don't consider to be pretty:
pub enum JmpCondition {
Overflow = 0b0000,
NoOverflow = 0b0001,
Below /* or NotAboveOrEqual */ = 0b0010,
AboveOrEqual /* or NotBelow */ = 0b0011,
Equal /* or Zero */ = 0b0100,
NotEqual /* or NotZero */ = 0b0101,
BelowOrEqual /* or NotAbove */ = 0b0110,
Above /* or NotBelowOrEqual */ = 0b0111,
Sign = 0b1000,
NoSign = 0b1001,
ParityEven /* or Parity */ = 0b1010,
ParityOdd /* or NotPar */ = 0b1011,
Less /* or NotGreaterOrEqual */ = 0b1100,
GreaterOrEqual /* or NotLess */ = 0b1101,
LessOrEqual /* or NotGreater */ = 0b1110,
Greater /* or NotLessOrEqual */ = 0b1111,
}
Invoking rustfmt on this strips the comments, and while I can agree that's not the best place to put them I'd expect rustfmt will not go to destroy them.
Versions: 1.5.1 / 1.5.2-nightly.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.