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