Skip to content

Commit cd285e1

Browse files
committed
Make output more compact when pretty printing vars
1 parent cd20e1c commit cd285e1

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

fathom/src/core/pretty.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ impl<'interner, 'arena> Context<'interner> {
119119
// FIXME: indentation and grouping
120120

121121
match term {
122-
Term::ItemVar(_, level) => RcDoc::text(format!("ItemVar({:?})", level)),
123-
Term::LocalVar(_, index) => RcDoc::text(format!("LocalVar({:?})", index)),
124-
Term::MetaVar(_, index) => RcDoc::text(format!("MetaVar({:?})", index)),
122+
Term::ItemVar(_, level) => RcDoc::text(format!("Item({})", level)),
123+
Term::LocalVar(_, index) => RcDoc::text(format!("Local({})", index)),
124+
Term::MetaVar(_, index) => RcDoc::text(format!("Meta({})", index)),
125125
Term::InsertedMeta(_, level, info) => {
126126
RcDoc::text(format!("InsertedMeta({:?}, {:?})", level, info))
127127
}

fathom/src/env.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ impl fmt::Debug for Index {
6464
}
6565
}
6666

67+
impl fmt::Display for Index {
68+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
69+
self.0.fmt(f)
70+
}
71+
}
72+
6773
/// An iterator over indices, listed from the most recently bound.
6874
pub fn indices() -> impl Iterator<Item = Index> {
6975
(0..).map(Index)
@@ -105,6 +111,12 @@ impl fmt::Debug for Level {
105111
}
106112
}
107113

114+
impl fmt::Display for Level {
115+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
116+
self.0.fmt(f)
117+
}
118+
}
119+
108120
/// An iterator over levels, listed from the least recently bound.
109121
pub fn levels() -> impl Iterator<Item = Level> {
110122
(0..).map(Level)

0 commit comments

Comments
 (0)