mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 05:33:27 +00:00
Auto merge of #101432 - nnethercote:shrink-PredicateS, r=lcnr
Shrink `PredicateS` r? `@ghost`
This commit is contained in:
commit
567e1bbca7
3 changed files with 5 additions and 5 deletions
|
@ -1175,7 +1175,7 @@ fn replace_types<'tcx>(
|
||||||
if replaced.insert(param_ty.index) {
|
if replaced.insert(param_ty.index) {
|
||||||
for projection_predicate in projection_predicates {
|
for projection_predicate in projection_predicates {
|
||||||
if projection_predicate.projection_ty.self_ty() == param_ty.to_ty(cx.tcx)
|
if projection_predicate.projection_ty.self_ty() == param_ty.to_ty(cx.tcx)
|
||||||
&& let ty::Term::Ty(term_ty) = projection_predicate.term
|
&& let Some(term_ty) = projection_predicate.term.ty()
|
||||||
&& let ty::Param(term_param_ty) = term_ty.kind()
|
&& let ty::Param(term_param_ty) = term_ty.kind()
|
||||||
{
|
{
|
||||||
let item_def_id = projection_predicate.projection_ty.item_def_id;
|
let item_def_id = projection_predicate.projection_ty.item_def_id;
|
||||||
|
|
|
@ -3304,9 +3304,9 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
|
||||||
// one of the associated types must be Self
|
// one of the associated types must be Self
|
||||||
for &(predicate, _span) in cx.tcx.explicit_item_bounds(def_id) {
|
for &(predicate, _span) in cx.tcx.explicit_item_bounds(def_id) {
|
||||||
if let ty::PredicateKind::Projection(projection_predicate) = predicate.kind().skip_binder() {
|
if let ty::PredicateKind::Projection(projection_predicate) = predicate.kind().skip_binder() {
|
||||||
let assoc_ty = match projection_predicate.term {
|
let assoc_ty = match projection_predicate.term.unpack() {
|
||||||
ty::Term::Ty(ty) => ty,
|
ty::TermKind::Ty(ty) => ty,
|
||||||
ty::Term::Const(_c) => continue,
|
ty::TermKind::Const(_c) => continue,
|
||||||
};
|
};
|
||||||
// walk the associated type and check for Self
|
// walk the associated type and check for Self
|
||||||
if let Some(self_adt) = self_ty.ty_adt_def() {
|
if let Some(self_adt) = self_ty.ty_adt_def() {
|
||||||
|
|
|
@ -274,7 +274,7 @@ fn check_other_call_arg<'tcx>(
|
||||||
.subst_and_normalize_erasing_regions(call_substs, cx.param_env, projection_predicate.term);
|
.subst_and_normalize_erasing_regions(call_substs, cx.param_env, projection_predicate.term);
|
||||||
implements_trait(cx, receiver_ty, deref_trait_id, &[])
|
implements_trait(cx, receiver_ty, deref_trait_id, &[])
|
||||||
&& get_associated_type(cx, receiver_ty, deref_trait_id, "Target")
|
&& get_associated_type(cx, receiver_ty, deref_trait_id, "Target")
|
||||||
.map_or(false, |ty| ty::Term::Ty(ty) == normalized_ty)
|
.map_or(false, |ty| ty::TermKind::Ty(ty) == normalized_ty.unpack())
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue