Skip to content

Commit 5bbb0d4

Browse files
Stop using ty::GenericPredicates for non-predicates_of queries
1 parent 508a7b4 commit 5bbb0d4

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

clippy_lints/src/implied_bounds_in_impls.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ fn collect_supertrait_bounds<'tcx>(cx: &LateContext<'tcx>, bounds: GenericBounds
246246
&& let [.., path] = poly_trait.trait_ref.path.segments
247247
&& poly_trait.bound_generic_params.is_empty()
248248
&& let Some(trait_def_id) = path.res.opt_def_id()
249-
&& let predicates = cx.tcx.explicit_super_predicates_of(trait_def_id).predicates
249+
&& let predicates = cx.tcx.explicit_super_predicates_of(trait_def_id).skip_binder()
250250
// If the trait has no supertrait, there is no need to collect anything from that bound
251251
&& !predicates.is_empty()
252252
{

clippy_lints/src/methods/type_id_on_box.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ fn is_subtrait_of_any(cx: &LateContext<'_>, ty: Ty<'_>) -> bool {
2525
|| cx
2626
.tcx
2727
.explicit_super_predicates_of(tr.def_id)
28-
.predicates
29-
.iter()
28+
.iter_identity_copied()
3029
.any(|(clause, _)| {
3130
matches!(clause.kind().skip_binder(), ty::ClauseKind::Trait(super_tr)
3231
if cx.tcx.is_diagnostic_item(sym::Any, super_tr.def_id()))

clippy_lints/src/needless_maybe_sized.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ fn path_to_sized_bound(cx: &LateContext<'_>, trait_bound: &PolyTraitRef<'_>) ->
9191
return true;
9292
}
9393

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

0 commit comments

Comments
 (0)