summaryrefslogtreecommitdiff
path: root/dhall
diff options
context:
space:
mode:
authorBasile Henry2020-11-02 23:09:14 +0100
committerBasile Henry2020-11-02 23:09:14 +0100
commit8b016bbabb6be73f395feda73e4e40a4c552536b (patch)
tree7222963e696a87289476aeb4e40e978fae0be253 /dhall
parentf485ad425a786b680526a36a23bf58db9b0224e4 (diff)
Inline helper function
Diffstat (limited to 'dhall')
-rw-r--r--dhall/src/operations/typecheck.rs12
1 files 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<Nir> =
Some(record.ty().as_nir().clone());
let mut visited: Vec<(&Label, HashMap<Label, Nir>)> = 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));