-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Extend extra_unused_lifetimes
to handle impl lifetimes
#8737
Conversation
r? @giraffate (rust-highfive has picked a reviewer for you, use r? to override) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would these cases be false positive? I found these here:
- https://github.com/rust-lang/cargo/blob/0.49.0/src/cargo/core/source/mod.rs#L111
- https://github.com/serde-rs/serde/blob/v1.0.118/serde/src/de/mod.rs#L476
// first case
use serde::de::Visitor;
pub trait Expected {
fn fmt(&self, formatter: &mut std::fmt::Formatter);
}
impl<'de, T> Expected for T
where
T: Visitor<'de>,
{
fn fmt(&self, formatter: &mut std::fmt::Formatter) {}
}
// second case
pub trait Source {
fn hey();
}
impl<'a, T: Source + ?Sized + 'a> Source for Box<T> {
fn hey() {}
}
The answer is "yes," of course. :) I think the just pushed commit fixes the problem. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good, thanks!
I made one comment for naming.
clippy_lints/src/lifetimes.rs
Outdated
ImplItemKind, Item, ItemKind, LangItem, Lifetime, LifetimeName, ParamName, PolyTraitRef, TraitBoundModifier, | ||
TraitFn, TraitItem, TraitItemKind, Ty, TyKind, WhereClause, WherePredicate, | ||
}; | ||
use rustc_lint::{LateContext, LateLintPass}; | ||
use rustc_middle::hir::nested_filter as mir_nested_filter; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know why this is named mir
. Can this be explained?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I misread the crate name. Maybe it's better now (middle_nested_filter
)?
@bors r+ Thanks! |
📌 Commit c22bb06 has been approved by |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Fixes #6437 (cc: @carols10cents)
changelog: fix #6437