We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 673e7f4 commit d1a58beCopy full SHA for d1a58be
crates/bevy_app/src/sub_schedule.rs
@@ -218,12 +218,15 @@ impl SubSchedules {
218
/// # Panics
219
/// If the schedule is currently [extracted](#method.extract_scope).
220
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
+
226
let label = label.as_label();
227
let sched = match self.map.get_mut(&label)?.0.as_deref_mut() {
228
Some(x) => x,
- None => {
- panic!("cannot get sub-schedule '{label:?}', as it is currently extracted");
- }
229
+ None => panic(label),
230
};
231
sched.downcast_mut()
232
}
0 commit comments