Skip to content

Commit fe82649

Browse files
committed
feat: add is_float & is_char to hir::Type
1 parent 9549753 commit fe82649

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

crates/hir/src/lib.rs

+8
Original file line numberDiff line numberDiff line change
@@ -3210,6 +3210,14 @@ impl Type {
32103210
matches!(self.ty.kind(Interner), TyKind::Scalar(Scalar::Uint(UintTy::Usize)))
32113211
}
32123212

3213+
pub fn is_float(&self) -> bool {
3214+
matches!(self.ty.kind(Interner), TyKind::Scalar(Scalar::Float(_)))
3215+
}
3216+
3217+
pub fn is_char(&self) -> bool {
3218+
matches!(self.ty.kind(Interner), TyKind::Scalar(Scalar::Char))
3219+
}
3220+
32133221
pub fn is_int_or_uint(&self) -> bool {
32143222
match self.ty.kind(Interner) {
32153223
TyKind::Scalar(Scalar::Int(_) | Scalar::Uint(_)) => true,

0 commit comments

Comments
 (0)