@@ -265,6 +265,7 @@ impl GraphEngine {
265265
266266 /// Emit a structured log event through the registered callback (if any).
267267 fn emit_log ( & self , level : hooks:: LogLevel , message : & str , context : & str ) {
268+ #[ allow( clippy:: collapsible_if) ]
268269 if let Ok ( guard) = self . logger . lock ( ) {
269270 if let Some ( ref logger) = * guard {
270271 logger ( level, message, context) ;
@@ -458,6 +459,7 @@ impl GraphEngine {
458459 #[ cfg( feature = "hot-reload" ) ]
459460 pub fn stop_watcher ( & self ) {
460461 self . shutdown_flag . store ( true , Ordering :: Relaxed ) ;
462+ #[ allow( clippy:: collapsible_if) ]
461463 if let Ok ( mut guard) = self . watcher_thread . lock ( ) {
462464 if let Some ( handle) = guard. take ( ) {
463465 handle. join ( ) . ok ( ) ;
@@ -739,6 +741,7 @@ impl GraphEngine {
739741 Some ( ctx_ref. as_ref ( ) ) ,
740742 None ,
741743 ) ;
744+ #[ allow( clippy:: collapsible_if) ]
742745 if let Ok ( r) = result {
743746 if r. found && evaluate_condition_if_present ( cond. as_ref ( ) , ctx_ref. as_ref ( ) )
744747 {
@@ -907,19 +910,21 @@ impl GraphEngine {
907910
908911 // Resolve permission to relations
909912 let resource_type = resource_type_name ( resource. as_str ( ) ) ;
910- let schema = self . schema . read ( ) . unwrap ( ) ;
911- let resolved = match policy:: resolve_permission ( & schema, & resource_type, permission) {
912- Some ( r) => r,
913- None => {
914- crate :: telemetry:: inc_check_total ( ) ;
915- crate :: telemetry:: inc_check_denied ( ) ;
916- return Ok ( CheckResult {
917- allowed : false ,
918- revision,
919- } ) ;
920- }
913+ let resolved = {
914+ let schema = self . schema . read ( ) . unwrap ( ) ;
915+ let result = match policy:: resolve_permission ( & schema, & resource_type, permission) {
916+ Some ( r) => r,
917+ None => {
918+ crate :: telemetry:: inc_check_total ( ) ;
919+ crate :: telemetry:: inc_check_denied ( ) ;
920+ return Ok ( CheckResult {
921+ allowed : false ,
922+ revision,
923+ } ) ;
924+ }
925+ } ;
926+ result
921927 } ;
922- drop ( schema) ;
923928
924929 // Evaluate each candidate relation by checking tuples from async storage
925930 let mut allowed = false ;
@@ -1140,6 +1145,7 @@ impl GraphEngine {
11401145 Some ( revision) ,
11411146 consistency,
11421147 ) ;
1148+ #[ allow( clippy:: collapsible_if) ]
11431149 if let Ok ( tr) = traversal_result {
11441150 if tr. found {
11451151 allowed = false ;
@@ -1293,6 +1299,7 @@ impl GraphEngine {
12931299 Some ( revision) ,
12941300 consistency,
12951301 ) ;
1302+ #[ allow( clippy:: collapsible_if) ]
12961303 if let Ok ( tr) = tr {
12971304 if tr. found {
12981305 allowed = false ;
@@ -1458,18 +1465,19 @@ impl GraphEngine {
14581465 . check ( & rl_key, RateLimitOp :: Write ) ?;
14591466
14601467 let resource_type = resource_type_name ( tuple. object . as_str ( ) ) ;
1461- let schema = self . schema . read ( ) . unwrap ( ) ;
1462- let type_def = match schema. types . get ( & resource_type) {
1463- Some ( t) => t,
1464- None => return Err ( AegisError :: UnknownSubjectType ( resource_type) ) ,
1465- } ;
1466- if !type_def. relations . contains_key ( tuple. relation . as_str ( ) ) {
1467- return Err ( AegisError :: UnknownRelation {
1468- type_name : resource_type,
1469- relation : tuple. relation . to_string ( ) ,
1470- } ) ;
1468+ {
1469+ let schema = self . schema . read ( ) . unwrap ( ) ;
1470+ let type_def = match schema. types . get ( & resource_type) {
1471+ Some ( t) => t,
1472+ None => return Err ( AegisError :: UnknownSubjectType ( resource_type) ) ,
1473+ } ;
1474+ if !type_def. relations . contains_key ( tuple. relation . as_str ( ) ) {
1475+ return Err ( AegisError :: UnknownRelation {
1476+ type_name : resource_type,
1477+ relation : tuple. relation . to_string ( ) ,
1478+ } ) ;
1479+ }
14711480 }
1472- drop ( schema) ;
14731481
14741482 let storage = self
14751483 . async_storage
@@ -2062,6 +2070,7 @@ impl GraphEngine {
20622070 let Some ( threshold) = self . wal_checkpoint_threshold else {
20632071 return ;
20642072 } ;
2073+ #[ allow( clippy:: collapsible_if) ]
20652074 if let Some ( wal_size) = self . storage . wal_size_mb ( ) {
20662075 if wal_size > threshold {
20672076 let _ = self . storage . close ( ) ;
0 commit comments