fix(stages): do not panic in disable_all (#9630)

This commit is contained in:
Alexey Shekhirin
2024-07-18 20:13:37 +01:00
committed by GitHub
parent fbef7f3f74
commit 820d3da2f6

View File

@@ -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