From 8b016bbabb6be73f395feda73e4e40a4c552536b Mon Sep 17 00:00:00 2001 From: Basile Henry Date: Mon, 2 Nov 2020 23:09:14 +0100 Subject: Inline helper function --- dhall/src/operations/typecheck.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/dhall/src/operations/typecheck.rs b/dhall/src/operations/typecheck.rs index 6da7027..bab80dc 100644 --- a/dhall/src/operations/typecheck.rs +++ b/dhall/src/operations/typecheck.rs @@ -507,13 +507,6 @@ pub fn typecheck_operation( use crate::syntax::Label; use std::iter::once; - let record_entries = |nir: &Nir| { - match nir.kind() { - NirKind::RecordType(kts) => Ok(kts.clone()), - _ => mk_span_err(span.clone(), "WithMustBeRecord"), // TODO better error - } - }; - let mut current_nir: Option = Some(record.ty().as_nir().clone()); let mut visited: Vec<(&Label, HashMap)> = Vec::new(); @@ -523,7 +516,10 @@ pub fn typecheck_operation( match current_nir { None => to_create.push(label), Some(nir) => { - let kts = record_entries(&nir)?; + let kts = (match nir.kind() { + NirKind::RecordType(kts) => Ok(kts.clone()), + _ => mk_span_err(span.clone(), "WithMustBeRecord"), // TODO better error + })?; current_nir = kts.get(label).cloned(); visited.push((label, kts)); -- cgit v1.2.3