From c551604b5a0b74a43f5efe567bcbd979daa2f3cc Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sat, 3 Apr 2021 13:08:29 +0200 Subject: Rename Ty::interned to Ty::kind ... since that's the actual method on Chalk side that matches the signature. --- crates/hir/src/lib.rs | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'crates/hir') 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 { } pub fn is_unit(&self) -> bool { - matches!(self.ty.interned(&Interner), TyKind::Tuple(0, ..)) + matches!(self.ty.kind(&Interner), TyKind::Tuple(0, ..)) } pub fn is_bool(&self) -> bool { - matches!(self.ty.interned(&Interner), TyKind::Scalar(Scalar::Bool)) + matches!(self.ty.kind(&Interner), TyKind::Scalar(Scalar::Bool)) } pub fn is_mutable_reference(&self) -> bool { - matches!(self.ty.interned(&Interner), TyKind::Ref(hir_ty::Mutability::Mut, ..)) + matches!(self.ty.kind(&Interner), TyKind::Ref(hir_ty::Mutability::Mut, ..)) } pub fn is_usize(&self) -> bool { - matches!(self.ty.interned(&Interner), TyKind::Scalar(Scalar::Uint(UintTy::Usize))) + matches!(self.ty.kind(&Interner), TyKind::Scalar(Scalar::Uint(UintTy::Usize))) } pub fn remove_ref(&self) -> Option { - match &self.ty.interned(&Interner) { + match &self.ty.kind(&Interner) { TyKind::Ref(.., ty) => Some(self.derived(ty.clone())), _ => None, } @@ -1855,15 +1855,15 @@ impl Type { } pub fn is_closure(&self) -> bool { - matches!(&self.ty.interned(&Interner), TyKind::Closure { .. }) + matches!(&self.ty.kind(&Interner), TyKind::Closure { .. }) } pub fn is_fn(&self) -> bool { - matches!(&self.ty.interned(&Interner), TyKind::FnDef(..) | TyKind::Function { .. }) + matches!(&self.ty.kind(&Interner), TyKind::FnDef(..) | TyKind::Function { .. }) } pub fn is_packed(&self, db: &dyn HirDatabase) -> bool { - let adt_id = match self.ty.interned(&Interner) { + let adt_id = match self.ty.kind(&Interner) { &TyKind::Adt(hir_ty::AdtId(adt_id), ..) => adt_id, _ => return false, }; @@ -1876,14 +1876,14 @@ impl Type { } pub fn is_raw_ptr(&self) -> bool { - matches!(&self.ty.interned(&Interner), TyKind::Raw(..)) + matches!(&self.ty.kind(&Interner), TyKind::Raw(..)) } pub fn contains_unknown(&self) -> bool { return go(&self.ty); fn go(ty: &Ty) -> bool { - match ty.interned(&Interner) { + match ty.kind(&Interner) { TyKind::Unknown => true, TyKind::Adt(_, substs) @@ -1914,7 +1914,7 @@ impl Type { } pub fn fields(&self, db: &dyn HirDatabase) -> Vec<(Field, Type)> { - let (variant_id, substs) = match self.ty.interned(&Interner) { + let (variant_id, substs) = match self.ty.kind(&Interner) { &TyKind::Adt(hir_ty::AdtId(AdtId::StructId(s)), ref substs) => (s.into(), substs), &TyKind::Adt(hir_ty::AdtId(AdtId::UnionId(u)), ref substs) => (u.into(), substs), _ => return Vec::new(), @@ -1931,7 +1931,7 @@ impl Type { } pub fn tuple_fields(&self, _db: &dyn HirDatabase) -> Vec { - if let TyKind::Tuple(_, substs) = &self.ty.interned(&Interner) { + if let TyKind::Tuple(_, substs) = &self.ty.kind(&Interner) { substs .iter(&Interner) .map(|ty| self.derived(ty.assert_ty_ref(&Interner).clone())) @@ -2120,7 +2120,7 @@ impl Type { fn walk_type(db: &dyn HirDatabase, type_: &Type, cb: &mut impl FnMut(Type)) { let ty = type_.ty.strip_references(); - match ty.interned(&Interner) { + match ty.kind(&Interner) { TyKind::Adt(..) => { cb(type_.derived(ty.clone())); } -- cgit v1.2.3