diff options
Diffstat (limited to 'tvix/eval')
-rw-r--r-- | tvix/eval/src/builtins/mod.rs | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/tvix/eval/src/builtins/mod.rs b/tvix/eval/src/builtins/mod.rs index 3ceafa498fcd..89e7c37d3f20 100644 --- a/tvix/eval/src/builtins/mod.rs +++ b/tvix/eval/src/builtins/mod.rs @@ -537,13 +537,8 @@ mod pure_builtins { let mut map = BTreeMap::new(); for val in list { let attrs = val.force(vm)?.to_attrs()?; - let get = |key| { - attrs - .select(key) - .ok_or(ErrorKind::AttributeNotFound { name: key.into() }) - }; - let name = get("name")?.to_str()?; - let value = get("value")?.clone(); + let name = attrs.select_required("name")?.force(vm)?.to_str()?; + let value = attrs.select_required("value")?.clone(); // Map entries earlier in the list take precedence over entries later in the list map.entry(name).or_insert(value); } |