From 655cd05300dc4c204eaac799381b39a20e020cc0 Mon Sep 17 00:00:00 2001 From: Worapol Worakunsap Date: Tue, 14 Nov 2023 20:25:47 +0700 Subject: [PATCH] fix: fixed wrong macro checking for ctx --- src/enforcer.rs | 8 ++++---- src/macros.rs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/enforcer.rs b/src/enforcer.rs index 0b73db8b..b9c05254 100644 --- a/src/enforcer.rs +++ b/src/enforcer.rs @@ -235,28 +235,28 @@ impl Enforcer { let r_ast = get_or_err_with_context!( self, "r", - ctx.r_type, + &ctx.r_type, ModelError::R, "request" ); let p_ast = get_or_err_with_context!( self, "p", - ctx.p_type, + &ctx.p_type, ModelError::P, "policy" ); let m_ast = get_or_err_with_context!( self, "m", - ctx.m_type, + &ctx.m_type, ModelError::M, "matcher" ); let e_ast = get_or_err_with_context!( self, "e", - ctx.e_type, + &ctx.e_type, ModelError::E, "effector" ); diff --git a/src/macros.rs b/src/macros.rs index 2670fcca..ed33f2ce 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -34,7 +34,7 @@ macro_rules! get_or_err_with_context { $msg ))) })? - .get(&format!("{}{}", $key, $ctx)) + .get($ctx) .ok_or_else(|| { $crate::error::Error::from($err(format!( "Missing {} section in conf file",