Back-to-back match blocks causes error[internal]: left behind trailing whitespace
Open
Nobody has claimed this yet.
A-binary-ops
A-closures
I-trailing-whitespace
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 24
Description
Having back-to-back match blocks causes this problem:
fn func<F: Fn(u8) -> u8>(f: F) -> u8 {
f(0)
}
fn main() {
func(|x|
match x {
x => x,
} + match x {
x => x,
}
);
}
results in
error[internal]: left behind trailing whitespace
--> /playground/src/main.rs:6:6:13
|
6 | func(|x|
| ^
|
warning: rustfmt has failed to format. See previous 1 errors.
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 provided Rust snippet and the reported error at playground/src/main.rs:6. Trace the formatter path for adjacent match blocks and trailing whitespace; done means the example formats without the internal error or leftover trailing whitespace.
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