Skip to content

Commit d1a58be

Browse files
committed
outline a panic
1 parent 673e7f4 commit d1a58be

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

crates/bevy_app/src/sub_schedule.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,15 @@ impl SubSchedules {
218218
/// # Panics
219219
/// If the schedule is currently [extracted](#method.extract_scope).
220220
pub fn get_mut<S: Stage>(&mut self, label: impl ScheduleLabel) -> Option<&mut S> {
221+
#[cold]
222+
fn panic(label: impl Debug) -> ! {
223+
panic!("cannot get sub-schedule '{label:?}', as it is currently extracted")
224+
}
225+
221226
let label = label.as_label();
222227
let sched = match self.map.get_mut(&label)?.0.as_deref_mut() {
223228
Some(x) => x,
224-
None => {
225-
panic!("cannot get sub-schedule '{label:?}', as it is currently extracted");
226-
}
229+
None => panic(label),
227230
};
228231
sched.downcast_mut()
229232
}

0 commit comments

Comments
 (0)