aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_ty/src/lib.rs')
-rw-r--r--crates/hir_ty/src/lib.rs28
1 files changed, 0 insertions, 28 deletions
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 {
198 _ => false, 198 _ => false,
199 } 199 }
200 } 200 }
201
202 /// Returns the type parameters of this type if it has some (i.e. is an ADT
203 /// or function); so if `self` is `Option<u32>`, this returns the `u32`.
204 pub fn substs(&self) -> Option<&Substitution> {
205 match self.kind(&Interner) {
206 TyKind::Adt(_, substs)
207 | TyKind::FnDef(_, substs)
208 | TyKind::Tuple(_, substs)
209 | TyKind::OpaqueType(_, substs)
210 | TyKind::AssociatedType(_, substs)
211 | TyKind::Closure(.., substs) => Some(substs),
212 TyKind::Function(FnPointer { substitution: substs, .. }) => Some(&substs.0),
213 _ => None,
214 }
215 }
216
217 fn substs_mut(&mut self) -> Option<&mut Substitution> {
218 match self.interned_mut() {
219 TyKind::Adt(_, substs)
220 | TyKind::FnDef(_, substs)
221 | TyKind::Tuple(_, substs)
222 | TyKind::OpaqueType(_, substs)
223 | TyKind::AssociatedType(_, substs)
224 | TyKind::Closure(.., substs) => Some(substs),
225 TyKind::Function(FnPointer { substitution: substs, .. }) => Some(&mut substs.0),
226 _ => None,
227 }
228 }
229} 201}
230 202
231#[derive(Copy, Clone, PartialEq, Eq, Debug, Hash)] 203#[derive(Copy, Clone, PartialEq, Eq, Debug, Hash)]