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 097309c10f
commit 55d8146334

View file

@ -90,8 +90,7 @@ pub fn contains_ty_adt_constructor_opaque<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'
return false;
}
for bound in cx.tcx.explicit_item_bounds(def_id).transpose_iter() {
let (predicate, _span) = bound.map_bound(|b| *b).subst_identity();
for (predicate, _span) in cx.tcx.explicit_item_bounds(def_id).subst_identity_iter_copied() {
match predicate.kind().skip_binder() {
// For `impl Trait<U>`, it will register a predicate of `T: Trait<U>`, so we go through
// and check substituions to find `U`.