Gives up on chains if any line is too long.
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 24
Description
If there is a method call chain, and just one call exceeds max_width, it seems like rustfmt gives up and doesn't format anything.
Example:
fn f() {
foo("This text is under the max_width limit, and shouldn't cause any problems on its own.").long("But this line is extra long, and doesn't fit within 100 max_width. 1234567890123456789").baz().collect().unwrap();
}
No format changes will be applied to this. I'm also a bit surprised that error_on_line_overflow does not complain.
I would expect it to wrap each call chain element, even if one of them is too long, such as:
fn f() {
foo("This text is under the max_width limit, and shouldn't cause any problems on its own.")
.long("But this line is extra long, and doesn't fit within 100 max_width. 1234567890123456789")
.baz()
.collect()
.unwrap();
}
All default settings.
rustfmt 1.4.8-nightly (afb1ee1c 2019-09-08)
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 issue's method-chain example with the default max_width and error_on_line_overflow settings, then trace rustfmt's method-chain formatting behavior. Done means each chain element is wrapped as shown, including when one call exceeds max_width, and the relevant overflow behavior is covered by a regression test.
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
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100