aboutsummaryrefslogtreecommitdiff
path: root/crates/hir/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir/src')
-rw-r--r--crates/hir/src/lib.rs26
1 files changed, 13 insertions, 13 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs
index fcc577384..29010191b 100644
--- a/crates/hir/src/lib.rs
+++ b/crates/hir/src/lib.rs
@@ -1711,22 +1711,22 @@ impl Type {
1711 } 1711 }
1712 1712
1713 pub fn is_unit(&self) -> bool { 1713 pub fn is_unit(&self) -> bool {
1714 matches!(self.ty.interned(&Interner), TyKind::Tuple(0, ..)) 1714 matches!(self.ty.kind(&Interner), TyKind::Tuple(0, ..))
1715 } 1715 }
1716 pub fn is_bool(&self) -> bool { 1716 pub fn is_bool(&self) -> bool {
1717 matches!(self.ty.interned(&Interner), TyKind::Scalar(Scalar::Bool)) 1717 matches!(self.ty.kind(&Interner), TyKind::Scalar(Scalar::Bool))
1718 } 1718 }
1719 1719
1720 pub fn is_mutable_reference(&self) -> bool { 1720 pub fn is_mutable_reference(&self) -> bool {
1721 matches!(self.ty.interned(&Interner), TyKind::Ref(hir_ty::Mutability::Mut, ..)) 1721 matches!(self.ty.kind(&Interner), TyKind::Ref(hir_ty::Mutability::Mut, ..))
1722 } 1722 }
1723 1723
1724 pub fn is_usize(&self) -> bool { 1724 pub fn is_usize(&self) -> bool {
1725 matches!(self.ty.interned(&Interner), TyKind::Scalar(Scalar::Uint(UintTy::Usize))) 1725 matches!(self.ty.kind(&Interner), TyKind::Scalar(Scalar::Uint(UintTy::Usize)))
1726 } 1726 }
1727 1727
1728 pub fn remove_ref(&self) -> Option<Type> { 1728 pub fn remove_ref(&self) -> Option<Type> {
1729 match &self.ty.interned(&Interner) { 1729 match &self.ty.kind(&Interner) {
1730 TyKind::Ref(.., ty) => Some(self.derived(ty.clone())), 1730 TyKind::Ref(.., ty) => Some(self.derived(ty.clone())),
1731 _ => None, 1731 _ => None,
1732 } 1732 }
@@ -1855,15 +1855,15 @@ impl Type {
1855 } 1855 }
1856 1856
1857 pub fn is_closure(&self) -> bool { 1857 pub fn is_closure(&self) -> bool {
1858 matches!(&self.ty.interned(&Interner), TyKind::Closure { .. }) 1858 matches!(&self.ty.kind(&Interner), TyKind::Closure { .. })
1859 } 1859 }
1860 1860
1861 pub fn is_fn(&self) -> bool { 1861 pub fn is_fn(&self) -> bool {
1862 matches!(&self.ty.interned(&Interner), TyKind::FnDef(..) | TyKind::Function { .. }) 1862 matches!(&self.ty.kind(&Interner), TyKind::FnDef(..) | TyKind::Function { .. })
1863 } 1863 }
1864 1864
1865 pub fn is_packed(&self, db: &dyn HirDatabase) -> bool { 1865 pub fn is_packed(&self, db: &dyn HirDatabase) -> bool {
1866 let adt_id = match self.ty.interned(&Interner) { 1866 let adt_id = match self.ty.kind(&Interner) {
1867 &TyKind::Adt(hir_ty::AdtId(adt_id), ..) => adt_id, 1867 &TyKind::Adt(hir_ty::AdtId(adt_id), ..) => adt_id,
1868 _ => return false, 1868 _ => return false,
1869 }; 1869 };
@@ -1876,14 +1876,14 @@ impl Type {
1876 } 1876 }
1877 1877
1878 pub fn is_raw_ptr(&self) -> bool { 1878 pub fn is_raw_ptr(&self) -> bool {
1879 matches!(&self.ty.interned(&Interner), TyKind::Raw(..)) 1879 matches!(&self.ty.kind(&Interner), TyKind::Raw(..))
1880 } 1880 }
1881 1881
1882 pub fn contains_unknown(&self) -> bool { 1882 pub fn contains_unknown(&self) -> bool {
1883 return go(&self.ty); 1883 return go(&self.ty);
1884 1884
1885 fn go(ty: &Ty) -> bool { 1885 fn go(ty: &Ty) -> bool {
1886 match ty.interned(&Interner) { 1886 match ty.kind(&Interner) {
1887 TyKind::Unknown => true, 1887 TyKind::Unknown => true,
1888 1888
1889 TyKind::Adt(_, substs) 1889 TyKind::Adt(_, substs)
@@ -1914,7 +1914,7 @@ impl Type {
1914 } 1914 }
1915 1915
1916 pub fn fields(&self, db: &dyn HirDatabase) -> Vec<(Field, Type)> { 1916 pub fn fields(&self, db: &dyn HirDatabase) -> Vec<(Field, Type)> {
1917 let (variant_id, substs) = match self.ty.interned(&Interner) { 1917 let (variant_id, substs) = match self.ty.kind(&Interner) {
1918 &TyKind::Adt(hir_ty::AdtId(AdtId::StructId(s)), ref substs) => (s.into(), substs), 1918 &TyKind::Adt(hir_ty::AdtId(AdtId::StructId(s)), ref substs) => (s.into(), substs),
1919 &TyKind::Adt(hir_ty::AdtId(AdtId::UnionId(u)), ref substs) => (u.into(), substs), 1919 &TyKind::Adt(hir_ty::AdtId(AdtId::UnionId(u)), ref substs) => (u.into(), substs),
1920 _ => return Vec::new(), 1920 _ => return Vec::new(),
@@ -1931,7 +1931,7 @@ impl Type {
1931 } 1931 }
1932 1932
1933 pub fn tuple_fields(&self, _db: &dyn HirDatabase) -> Vec<Type> { 1933 pub fn tuple_fields(&self, _db: &dyn HirDatabase) -> Vec<Type> {
1934 if let TyKind::Tuple(_, substs) = &self.ty.interned(&Interner) { 1934 if let TyKind::Tuple(_, substs) = &self.ty.kind(&Interner) {
1935 substs 1935 substs
1936 .iter(&Interner) 1936 .iter(&Interner)
1937 .map(|ty| self.derived(ty.assert_ty_ref(&Interner).clone())) 1937 .map(|ty| self.derived(ty.assert_ty_ref(&Interner).clone()))
@@ -2120,7 +2120,7 @@ impl Type {
2120 2120
2121 fn walk_type(db: &dyn HirDatabase, type_: &Type, cb: &mut impl FnMut(Type)) { 2121 fn walk_type(db: &dyn HirDatabase, type_: &Type, cb: &mut impl FnMut(Type)) {
2122 let ty = type_.ty.strip_references(); 2122 let ty = type_.ty.strip_references();
2123 match ty.interned(&Interner) { 2123 match ty.kind(&Interner) {
2124 TyKind::Adt(..) => { 2124 TyKind::Adt(..) => {
2125 cb(type_.derived(ty.clone())); 2125 cb(type_.derived(ty.clone()));
2126 } 2126 }