Unnamed repository; edit this file 'description' to name the repository.
Shrink `WherePredicate` by 8 bytes
| -rw-r--r-- | crates/hir-def/src/expr_store/lower/generics.rs | 2 | ||||
| -rw-r--r-- | crates/hir-def/src/hir/generics.rs | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/crates/hir-def/src/expr_store/lower/generics.rs b/crates/hir-def/src/expr_store/lower/generics.rs index 004bbe949f..5cea8a2435 100644 --- a/crates/hir-def/src/expr_store/lower/generics.rs +++ b/crates/hir-def/src/expr_store/lower/generics.rs @@ -227,7 +227,7 @@ impl GenericParamsCollector { (_, TypeBound::Error | TypeBound::Use(_)) => return, (Either::Left(type_ref), bound) => match hrtb_lifetimes { Some(hrtb_lifetimes) => WherePredicate::ForLifetime { - lifetimes: hrtb_lifetimes.to_vec().into_boxed_slice(), + lifetimes: ThinVec::from_iter(hrtb_lifetimes.iter().cloned()), target: type_ref, bound, }, diff --git a/crates/hir-def/src/hir/generics.rs b/crates/hir-def/src/hir/generics.rs index 685847c9fd..1bb9e48d55 100644 --- a/crates/hir-def/src/hir/generics.rs +++ b/crates/hir-def/src/hir/generics.rs @@ -4,6 +4,7 @@ use std::{ops, sync::LazyLock}; use hir_expand::name::Name; use la_arena::{Arena, Idx, RawIdx}; use stdx::impl_from; +use thin_vec::ThinVec; use triomphe::Arc; use crate::{ @@ -171,7 +172,7 @@ impl ops::Index<LocalLifetimeParamId> for GenericParams { pub enum WherePredicate { TypeBound { target: TypeRefId, bound: TypeBound }, Lifetime { target: LifetimeRef, bound: LifetimeRef }, - ForLifetime { lifetimes: Box<[Name]>, target: TypeRefId, bound: TypeBound }, + ForLifetime { lifetimes: ThinVec<Name>, target: TypeRefId, bound: TypeBound }, } static EMPTY: LazyLock<Arc<GenericParams>> = LazyLock::new(|| { |