From 820d3da2f68de10a5280f2fa771734abd7bae835 Mon Sep 17 00:00:00 2001 From: Alexey Shekhirin Date: Thu, 18 Jul 2024 20:13:37 +0100 Subject: [PATCH] fix(stages): do not panic in `disable_all` (#9630) --- crates/stages/api/src/pipeline/set.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/crates/stages/api/src/pipeline/set.rs b/crates/stages/api/src/pipeline/set.rs index 13dd86e128..baa9b0f3fc 100644 --- a/crates/stages/api/src/pipeline/set.rs +++ b/crates/stages/api/src/pipeline/set.rs @@ -201,12 +201,11 @@ where } /// Disables all given stages. See [`disable`](Self::disable). - #[track_caller] + /// + /// If any of the stages is not in this set, it is ignored. pub fn disable_all(mut self, stages: &[StageId]) -> Self { for stage_id in stages { - let entry = self.stages.get_mut(stage_id).unwrap_or_else(|| { - panic!("Cannot disable a stage that is not in the set: {stage_id}") - }); + let Some(entry) = self.stages.get_mut(stage_id) else { continue }; entry.enabled = false; } self