1
Fork 0

Allow the elaborator to only filter to real supertraits

This commit is contained in:
Michael Goulet 2023-02-02 21:22:02 +00:00
parent 4560b61cd1
commit 7ec72efe10
7 changed files with 106 additions and 47 deletions

View file

@ -255,6 +255,8 @@ 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(