mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 14:21:44 +00:00
Add TyBuilder::unit() and TyExt::is_unit()
This commit is contained in:
parent
b15152c430
commit
b0fe3d929f
7 changed files with 39 additions and 25 deletions
13
crates/hir_ty/src/chalk_ext.rs
Normal file
13
crates/hir_ty/src/chalk_ext.rs
Normal file
|
@ -0,0 +1,13 @@
|
|||
//! Various extensions traits for Chalk types.
|
||||
|
||||
use crate::{Interner, Ty, TyKind};
|
||||
|
||||
pub trait TyExt {
|
||||
fn is_unit(&self) -> bool;
|
||||
}
|
||||
|
||||
impl TyExt for Ty {
|
||||
fn is_unit(&self) -> bool {
|
||||
matches!(self.kind(&Interner), TyKind::Tuple(0, _))
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue