From c50336c0bd581c7e9c5799188212e81318f829a2 Mon Sep 17 00:00:00 2001 From: mo khan Date: Wed, 9 Jul 2025 17:43:19 -0600 Subject: refactor: combine conditionals --- src/authorization/cedar_authorizer.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/authorization') 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() { -- cgit v1.2.3