(hooks: &mut Map<String, Value>)
| 593 | } |
| 594 | |
| 595 | fn remove_atomic_hooks(hooks: &mut Map<String, Value>) { |
| 596 | for value in hooks.values_mut() { |
| 597 | let Some(groups) = value.as_array_mut() else { |
| 598 | continue; |
| 599 | }; |
| 600 | groups.retain_mut(|group| { |
| 601 | let Some(group_obj) = group.as_object_mut() else { |
| 602 | return true; |
| 603 | }; |
| 604 | let Some(group_hooks) = group_obj.get_mut("hooks").and_then(Value::as_array_mut) else { |
| 605 | return true; |
| 606 | }; |
| 607 | group_hooks.retain(|hook| { |
| 608 | !hook |
| 609 | .get("command") |
| 610 | .and_then(Value::as_str) |
| 611 | .is_some_and(is_atomic_hook) |
| 612 | }); |
| 613 | !group_hooks.is_empty() |
| 614 | }); |
| 615 | } |
| 616 | } |
| 617 | |
| 618 | fn is_atomic_hook(command: &str) -> bool { |
| 619 | command.contains(ATOMIC_HOOK_PREFIX) |
no test coverage detected