aboutsummaryrefslogtreecommitdiff
path: root/src/sexp/display.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/sexp/display.rs')
-rw-r--r--src/sexp/display.rs25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/sexp/display.rs b/src/sexp/display.rs
index e6dbb7c..238e8d4 100644
--- a/src/sexp/display.rs
+++ b/src/sexp/display.rs
@@ -26,20 +26,17 @@ impl fmt::Display for SExp {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Atom(leaf) => write!(f, "{}", leaf.to_string()),
- SCons(a, b) => {
- match scons(a.clone(), b.clone()).into_vec() {
- Ok(l) => write!(
- f,
- "({})",
- l.into_iter()
- .map(|x| x.to_string())
- .collect::<Vec<String>>()
- .join(" ")
- ),
- Err(_) => write!(f, "({} {})", *a, *b),
- }
- }
+ SCons(a, b) =>
+ write!(
+ f,
+ "({})",
+ scons(a.clone(), b.clone())
+ .parts()
+ .into_iter()
+ .map(|x| x.to_string())
+ .collect::<Vec<String>>()
+ .join(" ")
+ )
}
}
-
}