(hooks: &mut Map<String, Value>)
| 607 | } |
| 608 | |
| 609 | fn remove_atomic_hooks(hooks: &mut Map<String, Value>) { |
| 610 | for value in hooks.values_mut() { |
| 611 | let Some(groups) = value.as_array_mut() else { |
| 612 | continue; |
| 613 | }; |
| 614 | groups.retain_mut(|group| { |
| 615 | let Some(group_obj) = group.as_object_mut() else { |
| 616 | return true; |
| 617 | }; |
| 618 | let Some(group_hooks) = group_obj.get_mut("hooks").and_then(Value::as_array_mut) else { |
| 619 | return true; |
| 620 | }; |
| 621 | group_hooks.retain(|hook| { |
| 622 | !hook |
| 623 | .get("command") |
| 624 | .and_then(Value::as_str) |
| 625 | .is_some_and(is_atomic_hook) |
| 626 | }); |
| 627 | !group_hooks.is_empty() |
| 628 | }); |
| 629 | } |
| 630 | } |
| 631 | |
| 632 | fn is_atomic_hook(command: &str) -> bool { |
| 633 | command.contains(ATOMIC_HOOK_PREFIX) |
no test coverage detected