change usages of explicit_item_bounds to bound_explicit_item_bounds
This commit is contained in:
parent
a57fa08f48
commit
0892a7380b
13 changed files with 75 additions and 49 deletions
|
@ -254,23 +254,29 @@ impl<'tcx> LateLintPass<'tcx> for UnusedResults {
|
|||
}
|
||||
ty::Adt(def, _) => is_def_must_use(cx, def.did(), span),
|
||||
ty::Alias(ty::Opaque, ty::AliasTy { def_id: def, .. }) => {
|
||||
elaborate(cx.tcx, cx.tcx.explicit_item_bounds(def).iter().cloned())
|
||||
// We only care about self bounds for the impl-trait
|
||||
.filter_only_self()
|
||||
.find_map(|(pred, _span)| {
|
||||
// We only look at the `DefId`, so it is safe to skip the binder here.
|
||||
if let ty::PredicateKind::Clause(ty::Clause::Trait(
|
||||
ref poly_trait_predicate,
|
||||
)) = pred.kind().skip_binder()
|
||||
{
|
||||
let def_id = poly_trait_predicate.trait_ref.def_id;
|
||||
elaborate(
|
||||
cx.tcx,
|
||||
cx.tcx
|
||||
.bound_explicit_item_bounds(def)
|
||||
.transpose_iter()
|
||||
.map(|bound| bound.map_bound(|b| *b).subst_identity()),
|
||||
)
|
||||
// We only care about self bounds for the impl-trait
|
||||
.filter_only_self()
|
||||
.find_map(|(pred, _span)| {
|
||||
// We only look at the `DefId`, so it is safe to skip the binder here.
|
||||
if let ty::PredicateKind::Clause(ty::Clause::Trait(
|
||||
ref poly_trait_predicate,
|
||||
)) = pred.kind().skip_binder()
|
||||
{
|
||||
let def_id = poly_trait_predicate.trait_ref.def_id;
|
||||
|
||||
is_def_must_use(cx, def_id, span)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.map(|inner| MustUsePath::Opaque(Box::new(inner)))
|
||||
is_def_must_use(cx, def_id, span)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.map(|inner| MustUsePath::Opaque(Box::new(inner)))
|
||||
}
|
||||
ty::Dynamic(binders, _, _) => binders.iter().find_map(|predicate| {
|
||||
if let ty::ExistentialPredicate::Trait(ref trait_ref) = predicate.skip_binder()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue