Skip to content

Commit

Permalink
asserting that optional is not None if exists
Browse files Browse the repository at this point in the history
  • Loading branch information
ephraimfeldblum committed Nov 5, 2024
1 parent 7416603 commit 3b44a9a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 3b44a9a

Please sign in to comment.