summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-07-09 17:40:28 -0600
committermo khan <mo@mokhan.ca>2025-07-09 17:40:28 -0600
commit392874038d2ac78796bd8bdceaee6ce18e11c648 (patch)
tree2b07d7c847133c3fceb7c9dbbed4fc41984b8183
parent350be4f0dc862ea9b02a492356280ff63d4ace4e (diff)
refactor: use map_or instead of match expression
-rw-r--r--src/authorization/cedar_authorizer.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/authorization/cedar_authorizer.rs b/src/authorization/cedar_authorizer.rs
index f86bcf03..6d729772 100644
--- a/src/authorization/cedar_authorizer.rs
+++ b/src/authorization/cedar_authorizer.rs
@@ -43,11 +43,9 @@ impl CedarAuthorizer {
}
if path.is_file() {
- if let Some(extension) = path.extension() {
- if extension == "cedar" {
- let content = fs::read_to_string(&path)?;
- return Ok(cedar_policy::PolicySet::from_str(&content)?);
- }
+ if path.extension().map_or(false, |ext| ext == "cedar") {
+ let content = fs::read_to_string(&path)?;
+ return Ok(cedar_policy::PolicySet::from_str(&content)?);
}
}