From 92dcc53f94455e8933d76a8ba20642ceb069362d Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Wed, 7 Apr 2021 17:26:01 +0200 Subject: Remove Ty::substs{_mut} Almost all uses actually only care about ADT substs, so it's better to be explicit. The methods were a bad abstraction anyway since they already didn't include the inner types of e.g. `TyKind::Ref` anymore. --- crates/hir_ty/src/lib.rs | 28 ---------------------------- 1 file changed, 28 deletions(-) (limited to 'crates/hir_ty/src/lib.rs') diff --git a/crates/hir_ty/src/lib.rs b/crates/hir_ty/src/lib.rs index ae3987752..84645c435 100644 --- a/crates/hir_ty/src/lib.rs +++ b/crates/hir_ty/src/lib.rs @@ -198,34 +198,6 @@ impl Ty { _ => false, } } - - /// Returns the type parameters of this type if it has some (i.e. is an ADT - /// or function); so if `self` is `Option`, this returns the `u32`. - pub fn substs(&self) -> Option<&Substitution> { - match self.kind(&Interner) { - TyKind::Adt(_, substs) - | TyKind::FnDef(_, substs) - | TyKind::Tuple(_, substs) - | TyKind::OpaqueType(_, substs) - | TyKind::AssociatedType(_, substs) - | TyKind::Closure(.., substs) => Some(substs), - TyKind::Function(FnPointer { substitution: substs, .. }) => Some(&substs.0), - _ => None, - } - } - - fn substs_mut(&mut self) -> Option<&mut Substitution> { - match self.interned_mut() { - TyKind::Adt(_, substs) - | TyKind::FnDef(_, substs) - | TyKind::Tuple(_, substs) - | TyKind::OpaqueType(_, substs) - | TyKind::AssociatedType(_, substs) - | TyKind::Closure(.., substs) => Some(substs), - TyKind::Function(FnPointer { substitution: substs, .. }) => Some(&mut substs.0), - _ => None, - } - } } #[derive(Copy, Clone, PartialEq, Eq, Debug, Hash)] -- cgit v1.2.3