rustfmt removes newlines in comments between chain calls
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 24
Description
Unsure if this is intentional, but I assume it isn't. rustfmt removes newlines in comments between chain calls. I can get behind removing newlines between line comments, but removing them in block comments I find odd.
Original Code:
Minimal example to reproduce issue.
let x = (0..3)
/*
Foo
Bar
*/
.map(|i| i + 1)
// Foo
// Bar
.map(|i| i + 1)
/*
Foo
Bar
*/
.collect::<Vec<_>>();
Formatted Code:
let x = (0..3)
/*
Foo
Bar
*/
.map(|i| i + 1)
// Foo
// Bar
.map(|i| i + 1)
/*
Foo
Bar
*/
.collect::<Vec<_>>();
rustfmt 1.4.9-stable (33e36670 2019-10-07)
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
Reproduce the issue with the minimal Rust example in the report using rustfmt 1.4.9-stable. Compare the original and formatted output, then trace the comment-formatting path for comments between chained calls. Done should preserve blank lines in block comments while confirming the existing line-comment behavior.
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
- Mostly clear
- Newbie friendliness
- 35/100