From 31a03bf9140a2fdf5eb52d0998d2d41efaf0d610 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Tue, 3 Sep 2019 16:43:45 +0200 Subject: Use map_mut in ValueF::normalize_mut --- dhall/src/core/value.rs | 11 ----------- dhall/src/core/valuef.rs | 7 ++----- 2 files changed, 2 insertions(+), 16 deletions(-) (limited to 'dhall/src') diff --git a/dhall/src/core/value.rs b/dhall/src/core/value.rs index 3cccb1d..b4b6b08 100644 --- a/dhall/src/core/value.rs +++ b/dhall/src/core/value.rs @@ -212,17 +212,6 @@ impl Value { WHNF | NF => {} } } - pub(crate) fn normalize_nf(&self) { - let borrow = self.as_internal(); - match borrow.form { - Unevaled | WHNF => { - drop(borrow); - self.as_internal_mut().normalize_nf(); - } - // Already in NF - NF => {} - } - } pub(crate) fn app(&self, v: Value) -> Value { let body_t = match &*self.get_type_not_sort().as_whnf() { diff --git a/dhall/src/core/valuef.rs b/dhall/src/core/valuef.rs index 7ecec86..7a2b51c 100644 --- a/dhall/src/core/valuef.rs +++ b/dhall/src/core/valuef.rs @@ -189,7 +189,7 @@ impl ValueF { for x in elts.iter_mut() { use InterpolatedTextContents::{Expr, Text}; match x { - Expr(n) => n.normalize_mut(), + Expr(v) => v.normalize_mut(), Text(_) => {} } } @@ -199,10 +199,7 @@ impl ValueF { y.normalize_mut(); } ValueF::PartialExpr(e) => { - // TODO: need map_mut - e.map_ref(|v| { - v.normalize_nf(); - }); + e.map_mut(Value::normalize_mut); } } } -- cgit v1.2.3