refactor(tvix/eval/builtins): avoid unnecessary popping
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
This commit is contained in:
parent
a01524823a
commit
151f4437bc
1 changed files with 4 additions and 8 deletions
|
@ -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| {
|
||||
|
|
Loading…
Reference in a new issue