Fmt failure with wrap_comments = true
Open
Nobody has claimed this yet.
A-call-chains
A-comments
I-max-width
I-trailing-whitespace
UO-wrap_comments
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 24
Description
When having wrap_comments = true, running rustfmt on the following code produces an error:
fn f() {
g({
// some trailing spaces on the line below - this needs to be inside the g call
SomeStruct {
a: b, // // This needs two sets of the slash-slash comments, and this needs to be a very long sentence so bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla
};
})
.x; // the .something needs to be here
}
The produces error is error[internal]: left behind trailing whitespace
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.
Research direction
Start by reproducing the reported rustfmt failure with wrap_comments = true and the Rust example in the issue body. Trace the formatting path that handles trailing whitespace, wrapped comments, and the chained .x expression; done means the example formats without the internal trailing-whitespace error while preserving the comments and call structure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 42/100