rust-lang / rust-lang/rustfmt

Rustfmt ate a single line comment in a long list of trait bounds

Open
#3,669 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-binary-ops A-comments C-bug I-unexpectedly-removes-code
Dominant language
Rust
Stars
7k
Forks
1.1k
Avg merge
2d 13h
Merged PRs (30d)
24

Description

I ran a rustfmt cleanup as a commit on a repo, found this in the diff.

https://github.com/Lokathor/randomize/commit/103992e96309cd1484625c577ec10b7ae989ef18#diff-b316dc9cf67a100913b39ef102078235L48

Particularly:

-    + Into<u128> // Note(Evrey): Because Rust is drunk.
+    + Into<u128>

Now, in this particular case the comment was just a joke, but it could have been very important, and it might have even applied to that particular line in the chain of bounds, so the comment should stay in, and it should stay with that exact bound in the bound list.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing rustfmt on the linked randomize commit and inspect how it handles a single-line comment in a long trait-bound list. Add a regression test showing that the comment remains associated with its exact bound, then run the relevant rustfmt test suite.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.