rust-lang / rust-lang/rust-analyzer
Feature request: Use Result alias in extract-to-function assist
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
Currently, when I use extract to function on some fallible code in a function that returns syn::Result<_>, anyhow::Result<_> or a similar type alias for Result<_, SomeError>, the generated function uses the expanded form of that type alias. It would be nice if it used the same result alias as the function it is extracted from.
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 extract-to-function assist and the logic that determines the generated function's return type. Reproduce the case with a function returning a Result alias such as syn::Result<> or anyhow::Result<>, then verify that the extracted function preserves that alias instead of using the expanded Result form.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100