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 84b9b6d16c
commit 4501ae89f1
18 changed files with 25 additions and 17 deletions

View File

@@ -99,7 +99,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> {
debug!("build_constraints_for_item({})", tcx.def_path_str(def_id));
// Skip items with no generics - there's nothing to infer in them.
if tcx.generics_of(def_id).count() == 0 {
if tcx.generics_of(def_id).is_empty() {
return;
}

View File

@@ -41,7 +41,7 @@ fn crate_variances(tcx: TyCtxt<'_>, (): ()) -> CrateVariancesMap<'_> {
fn variances_of(tcx: TyCtxt<'_>, item_def_id: LocalDefId) -> &[ty::Variance] {
// Skip items with no generics - there's nothing to infer in them.
if tcx.generics_of(item_def_id).count() == 0 {
if tcx.generics_of(item_def_id).is_empty() {
return &[];
}