From c235b3286880ac0b6f9c3908c89c4821676506a4 Mon Sep 17 00:00:00 2001 From: Taeer Bar-Yam Date: Tue, 2 Jul 2024 16:44:04 -0400 Subject: [PATCH] check_call_opt_key: [] -> () (cherry picked from commit 76966c24dcf6413a4ebdfe0ddba00e3d1d7e5fff) --- rust/nix-expr/src/eval_state.rs | 4 ++-- rust/nix-util/src/context.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rust/nix-expr/src/eval_state.rs b/rust/nix-expr/src/eval_state.rs index d99f50d..7ba139a 100644 --- a/rust/nix-expr/src/eval_state.rs +++ b/rust/nix-expr/src/eval_state.rs @@ -225,12 +225,12 @@ impl EvalState { let attr_name = CString::new(attr_name) .with_context(|| "require_attrs_select_opt: attrName contains null byte")?; let v2 = unsafe { - check_call_opt_key!(raw::get_attr_byname[ + check_call_opt_key!(raw::get_attr_byname( &mut self.context, v.raw_ptr(), self.eval_state.as_ptr(), attr_name.as_ptr() - ]) + )) }?; Ok(v2.map(Value::new)) } diff --git a/rust/nix-util/src/context.rs b/rust/nix-util/src/context.rs index 1314360..f5db84d 100644 --- a/rust/nix-util/src/context.rs +++ b/rust/nix-util/src/context.rs @@ -105,10 +105,10 @@ pub use check_call; // TODO: Generalize this macro to work with any error code or any error handling logic #[macro_export] macro_rules! check_call_opt_key { - ($f:path[$ctx:expr, $($arg:expr),*]) => { + ($($f:ident)::+($ctx:expr, $($arg:expr),*)) => { { let ctx : &mut $crate::context::Context = $ctx; - let ret = $f(ctx.ptr(), $($arg,)*); + let ret = $($f)::*(ctx.ptr(), $($arg,)*); if unsafe { raw::err_code(ctx.ptr()) == raw::NIX_ERR_KEY } { ctx.clear(); return Ok(None);