Add TyBuilder::unit() and TyExt::is_unit()

This commit is contained in:
Florian Diebold 2021-04-03 20:22:59 +02:00
parent b15152c430
commit b0fe3d929f
7 changed files with 39 additions and 25 deletions

View 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, _))
}
}