rust-lang / rust-lang/rust-analyzer
Whitespace removed on filling match arms inside tokio::main breaking the code
Open
Nobody has claimed this yet.
A-assists
C-bug
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
rust-analyzer version: 0.3.2509-standalone
rustc version: 1.87.0
editor or extension: VSCode, extension 0.3.2509
relevant settings:
{
"rust-analyzer.check.command": "clippy",
"rust-analyzer.check.extraArgs": ["--all-features"],
"rust-analyzer.imports.granularity.enforce": true,
"rust-analyzer.imports.prefix": "crate",
}
code snippet to reproduce:
enum A {
B,
C,
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let a = A::B;
match a {
A::B => {
let x = 1;
}
}
Ok(())
}
Before:
After:
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
Reproduce the whitespace loss in rust-analyzer through the VSCode extension using the reported Rust, rustc, and rust-analyzer versions and the provided tokio::main match example. Compare the displayed before and after formatting, then trace the formatting or match-arm filling entry point. Done means filling match arms preserves the surrounding whitespace and leaves valid Rust code.
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
- 45/100