From f12f938166e5b0c773f3553fb7e7422a58e83c6d Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 13 Jan 2023 14:18:01 +0300 Subject: refactor(tvix/eval): directly return builtin tuples from macro 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 --- tvix/eval/builtin-macros/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tvix/eval/builtin-macros/src') diff --git a/tvix/eval/builtin-macros/src/lib.rs b/tvix/eval/builtin-macros/src/lib.rs index ff1c52e03fd8..5a54d499124d 100644 --- a/tvix/eval/builtin-macros/src/lib.rs +++ b/tvix/eval/builtin-macros/src/lib.rs @@ -209,8 +209,8 @@ pub fn builtins(_args: TokenStream, item: TokenStream) -> TokenStream { } items.push(parse_quote! { - pub fn builtins() -> Vec { - vec![#(#builtins),*] + pub fn builtins() -> Vec<(&'static str, Value)> { + vec![#(#builtins),*].into_iter().map(|b| (b.name(), Value::Builtin(b))).collect() } }); -- cgit 1.4.1