about summary refs log tree commit diff
path: root/tvix/eval/src/builtins/mod.rs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2023-01-13T11·18+0300
committertazjin <tazjin@tvl.su>2023-01-20T15·39+0000
commitf12f938166e5b0c773f3553fb7e7422a58e83c6d (patch)
treea120aa4f8fcd744e58048d627ab02b08d1a2f4d0 /tvix/eval/src/builtins/mod.rs
parent972c867b365631f771f6933cd9a6384316d5aea5 (diff)
refactor(tvix/eval): directly return builtin tuples from macro r/5707
All invocations of the builtin macro had to previously filter through
the `builtin_tuple` function, but it's more sensible to directly
return these from the macro.

Change-Id: I45600ba84d56c9528d3e92570461c319eea595ce
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7825
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
Diffstat (limited to 'tvix/eval/src/builtins/mod.rs')
-rw-r--r--tvix/eval/src/builtins/mod.rs14
1 files changed, 2 insertions, 12 deletions
diff --git a/tvix/eval/src/builtins/mod.rs b/tvix/eval/src/builtins/mod.rs
index 7614353f5bbb..b1ea408a8ca4 100644
--- a/tvix/eval/src/builtins/mod.rs
+++ b/tvix/eval/src/builtins/mod.rs
@@ -14,7 +14,7 @@ use crate::arithmetic_op;
 use crate::warnings::WarningKind;
 use crate::{
     errors::{ErrorKind, EvalResult},
-    value::{Builtin, CoercionKind, NixAttrs, NixList, NixString, Value},
+    value::{CoercionKind, NixAttrs, NixList, NixString, Value},
     vm::VM,
 };
 
@@ -968,17 +968,10 @@ mod pure_builtins {
     }
 }
 
-pub(crate) fn builtin_tuple(builtin: Builtin) -> (&'static str, Value) {
-    (builtin.name(), Value::Builtin(builtin))
-}
-
 /// The set of standard pure builtins in Nix, mostly concerned with
 /// data structure manipulation (string, attrs, list, etc. functions).
 pub fn pure_builtins() -> Vec<(&'static str, Value)> {
-    let mut result = pure_builtins::builtins()
-        .into_iter()
-        .map(builtin_tuple)
-        .collect::<Vec<_>>();
+    let mut result = pure_builtins::builtins();
 
     // Pure-value builtins
     result.push(("nixVersion", Value::String("2.3-compat-tvix-0.1".into())));
@@ -1038,7 +1031,4 @@ mod placeholder_builtins {
 
 pub fn placeholders() -> Vec<(&'static str, Value)> {
     placeholder_builtins::builtins()
-        .into_iter()
-        .map(builtin_tuple)
-        .collect()
 }