Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extra_unused_lifetimes does not warn on spurious for<'a> #13812

Open
jrose-signal opened this issue Dec 11, 2024 · 1 comment
Open

extra_unused_lifetimes does not warn on spurious for<'a> #13812

jrose-signal opened this issue Dec 11, 2024 · 1 comment
Labels
I-false-negative Issue: The lint should have been triggered on code, but wasn't

Comments

@jrose-signal
Copy link

I had the following code

pub async fn run<F>(body: impl for<'a> FnOnce(PathBuf) -> F)
where
    F: Future<Output = ()>,
{
  unimplemented!()
}

A colleague correctly noted I forgot to remove the lifetime qualification after changing from Path to PathBuf (though I probably didn't even need it before, I was experimenting with things). Clippy could have told me that too, but it didn't. (Nor does it for the longer-standing syntax of &mut dyn for<'a> FnMut(PathBuf).)

I think extra_unused_lifetimes is the lint that should have gotten it, but maybe not.

@samueltardieu
Copy link
Contributor

samueltardieu commented Dec 12, 2024

Indeed you should have been warned one way or another, but I wonder whether this is Clippy's job or if it belongs to the compiler proper. Unused generic parameters are not allowed in a type declaration, what about HRTB?

@samueltardieu samueltardieu added the I-false-negative Issue: The lint should have been triggered on code, but wasn't label Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-false-negative Issue: The lint should have been triggered on code, but wasn't
Projects
None yet
Development

No branches or pull requests

2 participants