1
Fork 0

make Debug impl for Term simpler

This commit is contained in:
Waffle Lapkin 2024-05-19 16:35:34 +02:00
parent 84b9b6d16c
commit 006866f558

View file

@ -536,14 +536,10 @@ unsafe impl<'tcx> Sync for Term<'tcx> where &'tcx (Ty<'tcx>, Const<'tcx>): Sync
impl Debug for Term<'_> { impl Debug for Term<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let data = if let Some(ty) = self.ty() { match self.unpack() {
format!("Term::Ty({ty:?})") TermKind::Ty(ty) => write!(f, "Term::Ty({ty:?})"),
} else if let Some(ct) = self.ct() { TermKind::Const(ct) => write!(f, "Term::Const({ct:?})"),
format!("Term::Ct({ct:?})") }
} else {
unreachable!()
};
f.write_str(&data)
} }
} }