From fff4c46e09d4edf25eba737f4d71bfdb1dbf4a82 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Mon, 6 Apr 2020 22:11:54 +0100 Subject: Extract operation-related code to a new module --- dhall/src/syntax/text/printer.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'dhall/src/syntax/text/printer.rs') diff --git a/dhall/src/syntax/text/printer.rs b/dhall/src/syntax/text/printer.rs index d655489..a85f435 100644 --- a/dhall/src/syntax/text/printer.rs +++ b/dhall/src/syntax/text/printer.rs @@ -1,3 +1,4 @@ +use crate::operations::OpKind; use crate::syntax::*; use itertools::Itertools; use std::fmt::{self, Display}; @@ -37,8 +38,8 @@ impl<'a> PhasedExpr<'a> { impl UnspannedExpr { // Annotate subexpressions with the appropriate phase, defaulting to Base fn annotate_with_phases(&self) -> ExprKind> { - use crate::syntax::ExprKind::*; - use crate::syntax::OpKind::*; + use ExprKind::*; + use OpKind::*; use PrintPhase::*; let with_base = self.map_ref(|e| PhasedExpr(e, Base)); match with_base { @@ -89,8 +90,8 @@ impl UnspannedExpr { f: &mut fmt::Formatter, phase: PrintPhase, ) -> Result<(), fmt::Error> { - use crate::syntax::ExprKind::*; - use crate::syntax::OpKind::*; + use ExprKind::*; + use OpKind::*; let needs_paren = match self { Lam(_, _, _) @@ -212,7 +213,7 @@ impl Display for ExprKind { /// Generic instance that delegates to subexpressions impl Display for OpKind { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { - use crate::syntax::OpKind::*; + use OpKind::*; match self { App(a, b) => { write!(f, "{} {}", a, b)?; -- cgit v1.2.3