(hooks: &mut Map<String, Value>)
| 470 | } |
| 471 | |
| 472 | fn remove_atomic_hooks(hooks: &mut Map<String, Value>) { |
| 473 | for value in hooks.values_mut() { |
| 474 | let Some(groups) = value.as_array_mut() else { |
| 475 | continue; |
| 476 | }; |
| 477 | groups.retain_mut(|group| { |
| 478 | let Some(group_obj) = group.as_object_mut() else { |
| 479 | return true; |
| 480 | }; |
| 481 | let Some(group_hooks) = group_obj.get_mut("hooks").and_then(Value::as_array_mut) else { |
| 482 | return true; |
| 483 | }; |
| 484 | group_hooks.retain(|hook| { |
| 485 | !hook |
| 486 | .get("command") |
| 487 | .and_then(Value::as_str) |
| 488 | .is_some_and(is_atomic_hook) |
| 489 | }); |
| 490 | !group_hooks.is_empty() |
| 491 | }); |
| 492 | } |
| 493 | } |
| 494 | |
| 495 | fn is_atomic_hook(command: &str) -> bool { |
| 496 | command.contains(ATOMIC_HOOK_PREFIX) |
no test coverage detected