From 0ce663a74da1fbb87133b694f38d57b7086015f5 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Tue, 30 Apr 2019 16:38:29 +0200 Subject: Pass references when possible --- dhall/src/lib.rs | 1 + dhall/src/normalize.rs | 151 ++++++++++++++++++++++++++++--------------------- dhall/src/typecheck.rs | 59 ++++++++++--------- 3 files changed, 121 insertions(+), 90 deletions(-) diff --git a/dhall/src/lib.rs b/dhall/src/lib.rs index 3860890..6e4361f 100644 --- a/dhall/src/lib.rs +++ b/dhall/src/lib.rs @@ -5,6 +5,7 @@ #![feature(non_exhaustive)] #![feature(bind_by_move_pattern_guards)] #![feature(try_trait)] +#![feature(inner_deref)] #![cfg_attr(test, feature(custom_inner_attributes))] #![allow( clippy::type_complexity, diff --git a/dhall/src/normalize.rs b/dhall/src/normalize.rs index f15eea4..26b23c2 100644 --- a/dhall/src/normalize.rs +++ b/dhall/src/normalize.rs @@ -25,7 +25,7 @@ impl<'a> Typed<'a> { /// leave ill-typed sub-expressions unevaluated. /// pub fn normalize(self) -> Normalized<'a> { - Normalized(self.0.as_whnf().normalize_to_expr(), self.1, self.2) + Normalized(self.0.normalize_whnf().normalize_to_expr(), self.1, self.2) } pub(crate) fn shift(&self, delta: isize, var: &V