Add and use generics.is_empty() and generics.is_own_empty, rather than using generics' attributes

This commit is contained in:
Santiago Pastorino 2024-05-11 11:46:25 +02:00
parent 37dfd973b7
commit 23e8b03f00
2 changed files with 2 additions and 2 deletions

View file

@ -225,7 +225,7 @@ impl {self_ty_without_ref} {{
&& let ImplItemKind::Fn(sig, _) = item.kind
&& let FnRetTy::Return(ret) = sig.decl.output
&& is_nameable_in_impl_trait(ret)
&& cx.tcx.generics_of(item_did).own_params.is_empty()
&& cx.tcx.generics_of(item_did).is_own_empty()
&& sig.decl.implicit_self == expected_implicit_self
&& sig.decl.inputs.len() == 1
&& let Some(imp) = get_parent_as_impl(cx.tcx, item.hir_id())

View file

@ -176,7 +176,7 @@ fn qpath_certainty(cx: &LateContext<'_>, qpath: &QPath<'_>, resolves_to_type: bo
.get(*lang_item)
.map_or(Certainty::Uncertain, |def_id| {
let generics = cx.tcx.generics_of(def_id);
if generics.parent_count == 0 && generics.own_params.is_empty() {
if generics.is_empty() {
Certainty::Certain(if resolves_to_type { Some(def_id) } else { None })
} else {
Certainty::Uncertain