Skip to content

Commit

Permalink
Get rid of clone_into as we know our time is Copy
Browse files Browse the repository at this point in the history
  • Loading branch information
nakedible committed Jun 28, 2023
1 parent 94bea5c commit 7f22e4a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions crates/bevy_time/src/fixed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,10 @@ pub fn run_fixed_update_schedule(
// Run the schedule until we run out of accumulated time
let _ = world.try_schedule_scope(FixedUpdate, |world, schedule| {
while world.resource_mut::<Time<Fixed>>().expend() {
world.resource::<Time<Fixed>>().as_generic().clone_into(world.resource_mut::<Time>().as_mut());
*world.resource_mut::<Time>() = world.resource::<Time<Fixed>>().as_generic();
schedule.run(world);
}
});
world.resource::<Time<Virtual>>().as_generic().clone_into(world.resource_mut::<Time>().as_mut());

*world.resource_mut::<Time>() = world.resource::<Time<Virtual>>().as_generic();
}
2 changes: 1 addition & 1 deletion crates/bevy_time/src/virt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,5 +241,5 @@ pub fn virtual_time_system(
};
virt.context_mut().effective_speed = effective_speed;
virt.advance_by(delta);
virt.as_generic().clone_into(current.as_mut());
*current = virt.as_generic();
}

0 comments on commit 7f22e4a

Please sign in to comment.