Rework redundant_closure

* Better track when a early-bound region appears when a late-bound region is required
* Don't lint when the closure gives explicit types.
This commit is contained in:
Jason Newcomb 2023-07-30 01:11:08 -04:00
parent 71cc39e1f2
commit 4d80a2ed2e
8 changed files with 371 additions and 157 deletions

View file

@ -189,7 +189,6 @@ impl LateLintPass<'_> for IncorrectImpls {
.diagnostic_items(trait_impl.def_id.krate)
.name_to_id
.get(&sym::Ord)
&& trait_impl.self_ty() == trait_impl.args.type_at(1)
&& implements_trait(cx, hir_ty_to_ty(cx.tcx, imp.self_ty), *ord_def_id, &[])
{
// If the `cmp` call likely needs to be fully qualified in the suggestion