rust-lang / rust-lang/rust-analyzer
Better Error Message For Incorrect -> Arrow In Closure?
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
Coming from the TypeScript world it's easy to accidentally add an arrow "->" when doing a one-liner closure, but I feel like this is a very cryptic error message that it gives...
Is there any way to have it suggest , "if you meant for this to be a closure, remove the arrow"?
Thanks! 👍 🦀
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 reported one-line closure syntax in rust-analyzer and locate the diagnostic entry point that emits the cryptic error. Done means the diagnostic explains that a closure should omit -> when that is the intended syntax, with a regression test covering the example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100