Skip to content

Commit

Permalink
Stop using ty::GenericPredicates for non-predicates_of queries
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Aug 29, 2024
1 parent 508a7b4 commit 5bbb0d4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion clippy_lints/src/implied_bounds_in_impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ fn collect_supertrait_bounds<'tcx>(cx: &LateContext<'tcx>, bounds: GenericBounds
&& let [.., path] = poly_trait.trait_ref.path.segments
&& poly_trait.bound_generic_params.is_empty()
&& let Some(trait_def_id) = path.res.opt_def_id()
&& let predicates = cx.tcx.explicit_super_predicates_of(trait_def_id).predicates
&& let predicates = cx.tcx.explicit_super_predicates_of(trait_def_id).skip_binder()
// If the trait has no supertrait, there is no need to collect anything from that bound
&& !predicates.is_empty()
{
Expand Down
3 changes: 1 addition & 2 deletions clippy_lints/src/methods/type_id_on_box.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ fn is_subtrait_of_any(cx: &LateContext<'_>, ty: Ty<'_>) -> bool {
|| cx
.tcx
.explicit_super_predicates_of(tr.def_id)
.predicates
.iter()
.iter_identity_copied()
.any(|(clause, _)| {
matches!(clause.kind().skip_binder(), ty::ClauseKind::Trait(super_tr)
if cx.tcx.is_diagnostic_item(sym::Any, super_tr.def_id()))
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/needless_maybe_sized.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ fn path_to_sized_bound(cx: &LateContext<'_>, trait_bound: &PolyTraitRef<'_>) ->
return true;
}

for &(predicate, _) in cx.tcx.explicit_super_predicates_of(trait_def_id).predicates {
for (predicate, _) in cx.tcx.explicit_super_predicates_of(trait_def_id).iter_identity_copied() {
if let ClauseKind::Trait(trait_predicate) = predicate.kind().skip_binder()
&& trait_predicate.polarity == PredicatePolarity::Positive
&& !path.contains(&trait_predicate.def_id())
Expand Down

0 comments on commit 5bbb0d4

Please sign in to comment.