rust-lang / rust-lang/rust-analyzer

Overwrite return type even if it is already specified

Open
#8,273 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-diagnostics S-unactionable
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

Currently, infer_function_return_type adds the return type only if the return type is missing. It would be nice if we have a choice to overwrite the return type based on the current tail expression, even if it is already specified (but it does not match).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating infer_function_return_type and read how it handles an existing return type. Determine where the requested overwrite choice should be exposed, then add coverage for a specified return type that differs from the current tail expression and verify the existing missing-type behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.