From 34e3ea8cc85e98ddb65a2bc75ccfe4297fa7a0fb Mon Sep 17 00:00:00 2001 From: Swarnim Arun Date: Mon, 13 Mar 2023 16:38:26 +0530 Subject: [PATCH] feat: add `remove_slice` to `hir::Type` --- crates/hir/src/lib.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index 25c07a2fbd..866641202c 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -3224,6 +3224,13 @@ impl Type { } } + pub fn remove_slice(&self) -> Option { + match &self.ty.kind(Interner) { + TyKind::Slice(ty) => Some(self.derived(ty.clone())), + _ => None, + } + } + pub fn strip_references(&self) -> Type { self.derived(self.ty.strip_references().clone()) }