Skip to content

Commit 2d4349c

Browse files
committed
Pack Term in the same way as GenericArg.
This shrinks the `PredicateS` type, which is instanted frequently.
1 parent 5b784f8 commit 2d4349c

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

clippy_lints/src/dereference.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1174,7 +1174,7 @@ fn replace_types<'tcx>(
11741174
if replaced.insert(param_ty.index) {
11751175
for projection_predicate in projection_predicates {
11761176
if projection_predicate.projection_ty.self_ty() == param_ty.to_ty(cx.tcx)
1177-
&& let ty::Term::Ty(term_ty) = projection_predicate.term
1177+
&& let Some(term_ty) = projection_predicate.term.ty()
11781178
&& let ty::Param(term_param_ty) = term_ty.kind()
11791179
{
11801180
let item_def_id = projection_predicate.projection_ty.item_def_id;

clippy_lints/src/methods/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3302,9 +3302,9 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
33023302
// one of the associated types must be Self
33033303
for &(predicate, _span) in cx.tcx.explicit_item_bounds(def_id) {
33043304
if let ty::PredicateKind::Projection(projection_predicate) = predicate.kind().skip_binder() {
3305-
let assoc_ty = match projection_predicate.term {
3306-
ty::Term::Ty(ty) => ty,
3307-
ty::Term::Const(_c) => continue,
3305+
let assoc_ty = match projection_predicate.term.unpack() {
3306+
ty::TermKind::Ty(ty) => ty,
3307+
ty::TermKind::Const(_c) => continue,
33083308
};
33093309
// walk the associated type and check for Self
33103310
if let Some(self_adt) = self_ty.ty_adt_def() {

clippy_lints/src/methods/unnecessary_to_owned.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ fn check_other_call_arg<'tcx>(
268268
.subst_and_normalize_erasing_regions(call_substs, cx.param_env, projection_predicate.term);
269269
implements_trait(cx, receiver_ty, deref_trait_id, &[])
270270
&& get_associated_type(cx, receiver_ty, deref_trait_id, "Target")
271-
.map_or(false, |ty| ty::Term::Ty(ty) == normalized_ty)
271+
.map_or(false, |ty| ty::TermKind::Ty(ty) == normalized_ty.unpack())
272272
} else {
273273
false
274274
}

0 commit comments

Comments
 (0)