Fail to format match arm when other arm has long line
Open
Nobody has claimed this yet.
A-call-chains
A-strings
I-poor-formatting
P-low
S-duplicate
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 24
Description
Rustfmt is not formatting the let a=0; part in this reduced testcase:
fn f() {
let mut a = Vec::new();
a.push(match 0 {
0 => {let a=0;""}
_ => r#"
--------------------loong line----------------------------------------------------------------------.
"#,
});
}
I am using rustfmt version:
rustfmt 0.99.6-nightly (750b252 2018-10-18)
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 reduced Rust testcase with the reported rustfmt version or a current build, then trace the formatting path for match arms when one arm contains a long raw string. Done means the let a=0; expression is formatted consistently with the other arm and the regression is covered by a test, though no test file is named in the issue.
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