rust-lang / rust-lang/rust-clippy

clippy misses some unneeded_return

Open
#7,939 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug I-false-negative
Dominant language
Rust
Stars
13.5k
Forks
2.2k
Avg merge
2d 10h
Merged PRs (30d)
32

Description

Lint name: unneeded_return

I tried this code:

https://gitlab.com/bp3d/bpx/bpx-rs/-/blob/620854b1f47facfa4a4d7f2a6bd580f71dd3aaa0/src/variant/package/decoder.rs#L128
https://gitlab.com/bp3d/bpx/bpx-rs/-/blob/620854b1f47facfa4a4d7f2a6bd580f71dd3aaa0/src/variant/shader/decoder.rs#L146

I expected to see this happen: clippy reports unneeded_return

Instead, this happened: clippy doesn't find anything

Meta

Rust version (rustc -Vv):

rustc 1.56.0 (09c42c458 2021-10-18)
binary: rustc
commit-hash: 09c42c45858d5f3aedfa670698275303a3d19afa
commit-date: 2021-10-18
host: x86_64-unknown-linux-gnu
release: 1.56.0
LLVM version: 13.0.0

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 reproducing the unneeded_return case from the linked decoder.rs locations with Rust 1.56.0, then inspect how the lint handles these return expressions and add a regression test for the missed cases. Done means Clippy reports unneeded_return for the reported examples without introducing unrelated diagnostics.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.