rust-lang / rust-lang/rust-clippy

No fix suggestion for extra_unused_lifetimes

Open
#5,374 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-enhancement E-medium E-needs-test L-suggestion
Dominant language
Rust
Stars
13.5k
Forks
2.2k
Avg merge
2d 10h
Merged PRs (30d)
32

Description

Resolving extra_unused_lifetimes seems pretty straightforward - just remove the lifetimes, but the diagnostic clippy emits doesn't have any fix suggestions. Is there any reason for it not to?

For example: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=1af0f2b1989bfb76f491af4a115e67a0

pub fn look_at_my_unused_lifetimes<'a>(msg: &str) {
    println!("print a msg: {}", msg);
}

produces the diagnostic:

    Checking playground v0.0.1 (/playground)
warning: this lifetime isn't used in the function definition
 --> src/lib.rs:1:36
  |
1 | pub fn look_at_my_unused_lifetimes<'a>(msg: &str) {
  |                                    ^^
  |
  = note: `#[warn(clippy::extra_unused_lifetimes)]` on by default
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes

    Finished dev [unoptimized + debuginfo] target(s) in 0.55s

which points out the problem clearly, but no fix suggestion for auto-replacement.

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 the implementation of the extra_unused_lifetimes lint in rust-clippy and reproduce the diagnostic with the Rust Playground example in the issue. The work is done when the diagnostic offers an automatic fix suggestion that removes the unused lifetime.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Feature
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.