rust-lang / rust-lang/rust-analyzer
Delegate method assist on enums
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 69
Description
Imo, the assist should work on enum variant fields, if all variants have the same named field or a field at the same index if they are tuple variants and all of the fields share a method. Having wrapper enums that "unify" two distinct types that serve similar purposes does happen at times.
enum Enum {
V1(Type$0),
V2(Type2),
}
here we should offer the assist to delegate any methods shared by Type and Type2 and then generate a method that matches on the variants and delegates appropriately.
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 locating the delegate-method assist entry point and any tests covering enum or variant-field delegation. Compare the requested behavior for named and tuple fields, then consider the work complete when shared methods are offered and generated delegation matches each enum variant.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- developer-experience, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100