about summary refs log tree commit diff
path: root/tvix
diff options
context:
space:
mode:
authorsterni <sternenseemann@systemli.org>2022-09-19T10·08+0200
committersterni <sternenseemann@systemli.org>2022-09-20T09·44+0000
commit151f4437bccd9e826c8fd666ebce9763c4b54a11 (patch)
tree06a9c8f793c50aa17fa21d1a7c632950e6e2a358 /tvix
parenta01524823aef834389b8eab50d6bf8f6c7d23bbf (diff)
refactor(tvix/eval/builtins): avoid unnecessary popping r/4932
Change-Id: I631b442e19e5c05455d705291c11037eae9ed9e0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6694
Autosubmit: sterni <sternenseemann@systemli.org>
Reviewed-by: grfn <grfn@gws.fyi>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix')
-rw-r--r--tvix/eval/src/builtins/mod.rs12
1 files changed, 4 insertions, 8 deletions
diff --git a/tvix/eval/src/builtins/mod.rs b/tvix/eval/src/builtins/mod.rs
index 0268f4f645..7e55e8bdbf 100644
--- a/tvix/eval/src/builtins/mod.rs
+++ b/tvix/eval/src/builtins/mod.rs
@@ -55,10 +55,8 @@ fn pure_builtins() -> Vec<Builtin> {
             let a = args.pop().unwrap();
             arithmetic_op!(a, b, +)
         }),
-        Builtin::new("abort", &[true], |mut args, _| {
-            return Err(ErrorKind::Abort(
-                args.pop().unwrap().to_str()?.as_str().to_owned(),
-            ));
+        Builtin::new("abort", &[true], |args, _| {
+            return Err(ErrorKind::Abort(args[0].to_str()?.to_string()));
         }),
         Builtin::new("attrNames", &[true], |args, _| {
             let xs = args[0].to_attrs()?;
@@ -233,10 +231,8 @@ fn pure_builtins() -> Vec<Builtin> {
                 Ok(Value::List(NixList::construct(output.len(), output)))
             }
         }),
-        Builtin::new("throw", &[true], |mut args, _| {
-            return Err(ErrorKind::Throw(
-                args.pop().unwrap().to_str()?.as_str().to_owned(),
-            ));
+        Builtin::new("throw", &[true], |args, _| {
+            return Err(ErrorKind::Throw(args[0].to_str()?.to_string()));
         }),
         // coerce_to_string forces for us
         Builtin::new("toString", &[false], |args, vm| {