rustfmt fails to format array that contains more than one struct lit which exceeds max_width
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 24
Description
Describe the bug
I have a const array of structs. If the array has more than 8 elements rustfmt will not format the file.
To Reproduce
Run rstfmt on the contents of https://gist.github.com/farrel/c982304bdefe5c2ee2c8ee8207a3e0ff
Expected behavior
The file should be formatted.
Meta
- rustfmt version: rustfmt 1.4.17-stable (8a93416 2020-07-20)
- From where did you install rustfmt?: rustup
- How do you run rustfmt:
rustfmt,cargo-fmt, vim integration (all fail)
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 failure with rustfmt on the linked gist, including an array with more than eight struct literals and elements exceeding max_width. Trace the array formatting path and verify the result through rustfmt, cargo-fmt, and the reported Vim integration; done means the input formats successfully and the regression is covered.
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