aboutsummaryrefslogtreecommitdiff
path: root/crates/hir/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir/src')
-rw-r--r--crates/hir/src/lib.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs
index c5161dadd..1a1454068 100644
--- a/crates/hir/src/lib.rs
+++ b/crates/hir/src/lib.rs
@@ -1631,6 +1631,13 @@ impl Type {
1631 matches!(self.ty.value.interned(&Interner), TyKind::Ref(hir_ty::Mutability::Mut, ..)) 1631 matches!(self.ty.value.interned(&Interner), TyKind::Ref(hir_ty::Mutability::Mut, ..))
1632 } 1632 }
1633 1633
1634 pub fn is_usize(&self) -> bool {
1635 matches!(
1636 self.ty.value.interned(&Interner),
1637 TyKind::Scalar(Scalar::Uint(hir_ty::primitive::UintTy::Usize))
1638 )
1639 }
1640
1634 pub fn remove_ref(&self) -> Option<Type> { 1641 pub fn remove_ref(&self) -> Option<Type> {
1635 match &self.ty.value.interned(&Interner) { 1642 match &self.ty.value.interned(&Interner) {
1636 TyKind::Ref(.., ty) => Some(self.derived(ty.clone())), 1643 TyKind::Ref(.., ty) => Some(self.derived(ty.clone())),