From 3b44a9aaac71254f73ec6170bb7543e8d76f3ef0 Mon Sep 17 00:00:00 2001 From: Ephraim Feldblum Date: Tue, 5 Nov 2024 13:42:27 +0200 Subject: [PATCH] asserting that optional is not None if exists --- src/macros.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/macros.rs b/src/macros.rs index e480a2da..77970b50 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -63,11 +63,12 @@ macro_rules! redis_command { let mut optional_failed = true; let mut acl_categories = CString::default(); $( - optional_failed = false; let optional = AclCategory::from($optional_acl_categories); + assert!(optional != AclCategory::None); + optional_failed = false; if mandatory != AclCategory::None && optional != AclCategory::None { acl_categories = CString::new(format!("{mandatory} {optional}")).unwrap(); - } else if optional != AclCategory::None { + } else { acl_categories = CString::new(format!("{optional}")).unwrap(); } // Warn if optional ACL categories are not set, but don't fail.