summaryrefslogtreecommitdiff
path: root/dhall_core/src/printer.rs
diff options
context:
space:
mode:
authorNadrieril2019-03-31 19:08:08 +0200
committerNadrieril2019-03-31 19:08:08 +0200
commit7374d0524ccd53b256107667b213597c05720d2d (patch)
tree69dc0e324ffbe3ecf928c62f4e900000f11c5386 /dhall_core/src/printer.rs
parentbfe3f7f75570540fa184a133653d16e86f22667a (diff)
Move recursion out of Expr
Diffstat (limited to 'dhall_core/src/printer.rs')
-rw-r--r--dhall_core/src/printer.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/dhall_core/src/printer.rs b/dhall_core/src/printer.rs
index b153d1b..b7d7506 100644
--- a/dhall_core/src/printer.rs
+++ b/dhall_core/src/printer.rs
@@ -35,7 +35,7 @@ impl<S, A: Display> Expr<S, A> {
f: &mut fmt::Formatter,
phase: PrintPhase,
) -> Result<(), fmt::Error> {
- use crate::Expr::*;
+ use crate::ExprF::*;
use PrintPhase::*;
match self {
_ if phase == Paren => {
@@ -143,7 +143,7 @@ impl<S, A: Display> Expr<S, A> {
write!(f, " : ")?;
b.fmt(f)?;
}
- Expr::BinOp(op, a, b) => {
+ ExprF::BinOp(op, a, b) => {
// Precedence is magically handled by the ordering of BinOps.
if phase > PrintPhase::BinOp(*op) {
return self.fmt_phase(f, Paren);
@@ -152,7 +152,7 @@ impl<S, A: Display> Expr<S, A> {
write!(f, " {} ", op)?;
b.fmt_phase(f, PrintPhase::BinOp(*op))?;
}
- Expr::App(a, args) => {
+ ExprF::App(a, args) => {
if phase > PrintPhase::App {
return self.fmt_phase(f, Paren);
}
@@ -239,7 +239,7 @@ where
f.write_str(close)
}
-impl<S, A: Display> Display for InterpolatedText<S, A> {
+impl<SubExpr: Display + Clone> Display for InterpolatedText<SubExpr> {
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
f.write_str("\"")?;
for x in self.iter() {