diff options
| author | Akshay <nerdy@peppe.rs> | 2022-02-24 15:20:12 +0530 |
|---|---|---|
| committer | Akshay <nerdy@peppe.rs> | 2022-02-24 15:20:12 +0530 |
| commit | a5ab6a2f755d275e6218060ef87e35d571133bf9 (patch) | |
| tree | 643757f43e8f23b36110d8be565871377e8b4a5b | |
| parent | 1f5f4ccfb1fe517278f5c093e55528d23d9cd1c7 (diff) | |
| download | rust-a5ab6a2f755d275e6218060ef87e35d571133bf9.tar.gz rust-a5ab6a2f755d275e6218060ef87e35d571133bf9.zip | |
add `is_slice` method to `hir::Type`
| -rw-r--r-- | crates/hir/src/lib.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index f41e7ee4c4c..bd1e8278d51 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -2507,6 +2507,10 @@ impl Type { matches!(self.ty.kind(Interner), TyKind::Ref(..)) } + pub fn is_slice(&self) -> bool { + matches!(self.ty.kind(Interner), TyKind::Slice(..)) + } + pub fn is_usize(&self) -> bool { matches!(self.ty.kind(Interner), TyKind::Scalar(Scalar::Uint(UintTy::Usize))) } |
