mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
feat: add is_float
& is_char
to hir::Type
This commit is contained in:
parent
9549753352
commit
fe82649e77
1 changed files with 8 additions and 0 deletions
|
@ -3210,6 +3210,14 @@ impl Type {
|
|||
matches!(self.ty.kind(Interner), TyKind::Scalar(Scalar::Uint(UintTy::Usize)))
|
||||
}
|
||||
|
||||
pub fn is_float(&self) -> bool {
|
||||
matches!(self.ty.kind(Interner), TyKind::Scalar(Scalar::Float(_)))
|
||||
}
|
||||
|
||||
pub fn is_char(&self) -> bool {
|
||||
matches!(self.ty.kind(Interner), TyKind::Scalar(Scalar::Char))
|
||||
}
|
||||
|
||||
pub fn is_int_or_uint(&self) -> bool {
|
||||
match self.ty.kind(Interner) {
|
||||
TyKind::Scalar(Scalar::Int(_) | Scalar::Uint(_)) => true,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue