From 24e876b52ed76710593895bc37bb8ed303075193 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Mon, 5 Apr 2021 02:03:37 +0200 Subject: Intern more `TypeRef`s in generics Saves ~3 MB --- crates/hir_ty/src/utils.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'crates/hir_ty') diff --git a/crates/hir_ty/src/utils.rs b/crates/hir_ty/src/utils.rs index b23e91b1b..c85c328af 100644 --- a/crates/hir_ty/src/utils.rs +++ b/crates/hir_ty/src/utils.rs @@ -32,11 +32,10 @@ fn direct_super_traits(db: &dyn DefDatabase, trait_: TraitId) -> Vec { .filter_map(|pred| match pred { WherePredicate::ForLifetime { target, bound, .. } | WherePredicate::TypeBound { target, bound } => match target { - WherePredicateTypeTarget::TypeRef(TypeRef::Path(p)) - if p == &Path::from(name![Self]) => - { - bound.as_path() - } + WherePredicateTypeTarget::TypeRef(type_ref) => match &**type_ref { + TypeRef::Path(p) if p == &Path::from(name![Self]) => bound.as_path(), + _ => None, + }, WherePredicateTypeTarget::TypeParam(local_id) if Some(*local_id) == trait_self => { bound.as_path() } -- cgit v1.2.3