diff options
| author | Swarnim Arun <swarnimarun11@gmail.com> | 2023-03-13 16:38:26 +0530 |
|---|---|---|
| committer | Swarnim Arun <swarnimarun11@gmail.com> | 2023-03-13 16:49:24 +0530 |
| commit | 34e3ea8cc85e98ddb65a2bc75ccfe4297fa7a0fb (patch) | |
| tree | f8125155def08f28069daec74d84a6d835aec55a | |
| parent | 95497533524537b1cc7a2870ce94b0b14503be8b (diff) | |
| download | rust-34e3ea8cc85e98ddb65a2bc75ccfe4297fa7a0fb.tar.gz rust-34e3ea8cc85e98ddb65a2bc75ccfe4297fa7a0fb.zip | |
feat: add `remove_slice` to `hir::Type`
| -rw-r--r-- | crates/hir/src/lib.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index 25c07a2fbd3..866641202cc 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<Type> { + 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()) } |
