diff options
| author | mo khan <mo@mokhan.ca> | 2025-07-09 17:43:19 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-07-09 17:43:19 -0600 |
| commit | c50336c0bd581c7e9c5799188212e81318f829a2 (patch) | |
| tree | b44cb03ace53ac0bd4fbf280a2ca83ac4c10e693 | |
| parent | 392874038d2ac78796bd8bdceaee6ce18e11c648 (diff) | |
refactor: combine conditionals
| -rw-r--r-- | src/authorization/cedar_authorizer.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/authorization/cedar_authorizer.rs b/src/authorization/cedar_authorizer.rs index 6d729772..c6b886ec 100644 --- a/src/authorization/cedar_authorizer.rs +++ b/src/authorization/cedar_authorizer.rs @@ -42,11 +42,9 @@ impl CedarAuthorizer { return Ok(cedar_policy::PolicySet::default()); } - if path.is_file() { - if path.extension().map_or(false, |ext| ext == "cedar") { - let content = fs::read_to_string(&path)?; - return Ok(cedar_policy::PolicySet::from_str(&content)?); - } + if path.is_file() && path.extension().map_or(false, |ext| ext == "cedar") { + let content = fs::read_to_string(&path)?; + return Ok(cedar_policy::PolicySet::from_str(&content)?); } if !path.is_dir() { |
