Skip to content

Commit f02be4b

Browse files
committed
Better to reuse the DerefMut function when implementing AsMut
1 parent 80c2017 commit f02be4b

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

crates/bevy_ecs/src/system/system_param.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,7 @@ impl<'w, T: Component> AsRef<T> for ResMut<'w, T> {
381381

382382
impl<'w, T: Component> AsMut<T> for ResMut<'w, T> {
383383
fn as_mut(&mut self) -> &mut T {
384-
self.ticks.set_changed(self.change_tick);
385-
&mut *self
384+
self.deref_mut()
386385
}
387386
}
388387

crates/bevy_ecs/src/world/pointer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ impl<'w, T> AsRef<T> for Mut<'w, T> {
4747

4848
impl<'w, T> AsMut<T> for Mut<'w, T> {
4949
fn as_mut(&mut self) -> &mut T {
50-
&mut *self
50+
self.deref_mut()
5151
}
5252
}
5353

0 commit comments

Comments
 (0)