Formatting error: closing curly-brace placed to the last comment (using `visual` imports indent)
Open
Nobody has claimed this yet.
A-comments
A-imports
C-bug
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 24
Description
Valid code example (just from some crate documentation):
use binrw::{
binrw, // #[binrw] attribute
BinRead, // trait for reading
BinWrite, // trait for writing
};
My rustfmt.toml:
imports_indent = "Visual"
Version of rustfmt: rustfmt 1.8.0-nightly (4392847410 2024-10-21)
Expected result of formatting example code above: (something like this, not sure)
use binrw::{binrw, // #[binrw] attribute
BinRead, // trait for reading
BinWrite, // trait for writing
};
Actual result that breaks the code - closing curly-brace placed to the last comment:
use binrw::{binrw, // #[binrw] attribute
BinRead, // trait for reading
BinWrite // trait for writing};
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 formatting of the documented Rust import with rustfmt 1.8.0-nightly and imports_indent = "Visual" in rustfmt.toml. Trace how line comments and the closing brace are handled, then ensure formatting keeps the brace outside the final comment and add coverage for this example.
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
- 38/100