Make queries more explicit

This commit is contained in:
Michael Goulet 2024-06-27 12:01:49 -04:00
parent f90d702e66
commit b60a6ad7f5
3 changed files with 3 additions and 3 deletions

View File

@ -246,7 +246,7 @@ fn collect_supertrait_bounds<'tcx>(cx: &LateContext<'tcx>, bounds: GenericBounds
&& let [.., path] = poly_trait.trait_ref.path.segments && let [.., path] = poly_trait.trait_ref.path.segments
&& poly_trait.bound_generic_params.is_empty() && poly_trait.bound_generic_params.is_empty()
&& let Some(trait_def_id) = path.res.opt_def_id() && let Some(trait_def_id) = path.res.opt_def_id()
&& let predicates = cx.tcx.super_predicates_of(trait_def_id).predicates && let predicates = cx.tcx.explicit_super_predicates_of(trait_def_id).predicates
// If the trait has no supertrait, there is no need to collect anything from that bound // If the trait has no supertrait, there is no need to collect anything from that bound
&& !predicates.is_empty() && !predicates.is_empty()
{ {

View File

@ -24,7 +24,7 @@ fn is_subtrait_of_any(cx: &LateContext<'_>, ty: Ty<'_>) -> bool {
cx.tcx.is_diagnostic_item(sym::Any, tr.def_id) cx.tcx.is_diagnostic_item(sym::Any, tr.def_id)
|| cx || cx
.tcx .tcx
.super_predicates_of(tr.def_id) .explicit_super_predicates_of(tr.def_id)
.predicates .predicates
.iter() .iter()
.any(|(clause, _)| { .any(|(clause, _)| {

View File

@ -91,7 +91,7 @@ fn path_to_sized_bound(cx: &LateContext<'_>, trait_bound: &PolyTraitRef<'_>) ->
return true; return true;
} }
for &(predicate, _) in cx.tcx.super_predicates_of(trait_def_id).predicates { for &(predicate, _) in cx.tcx.explicit_super_predicates_of(trait_def_id).predicates {
if let ClauseKind::Trait(trait_predicate) = predicate.kind().skip_binder() if let ClauseKind::Trait(trait_predicate) = predicate.kind().skip_binder()
&& trait_predicate.polarity == PredicatePolarity::Positive && trait_predicate.polarity == PredicatePolarity::Positive
&& !path.contains(&trait_predicate.def_id()) && !path.contains(&trait_predicate.def_id())