add subst_identity_iter and subst_identity_iter_copied methods on EarlyBinder; use this to simplify some EarlyBinder noise around explicit_item_bounds calls

This commit is contained in:
Kyle Matsuda 2023-04-17 17:19:08 -06:00
parent f3b279fcc5
commit e54854f6a9
12 changed files with 43 additions and 50 deletions

View file

@ -297,8 +297,7 @@ fn bounds_reference_self(tcx: TyCtxt<'_>, trait_def_id: DefId) -> SmallVec<[Span
tcx.associated_items(trait_def_id)
.in_definition_order()
.filter(|item| item.kind == ty::AssocKind::Type)
.flat_map(|item| tcx.explicit_item_bounds(item.def_id).transpose_iter())
.map(|bound| bound.map_bound(|b| *b).subst_identity())
.flat_map(|item| tcx.explicit_item_bounds(item.def_id).subst_identity_iter_copied())
.filter_map(|pred_span| predicate_references_self(tcx, pred_span))
.collect()
}