Skip to content

Commit 4453650

Browse files
committed
remove unnecessary unsafe
1 parent 9483f1a commit 4453650

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

crates/bevy_hierarchy/src/hierarchy.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ impl<'w, 's, 'a> DespawnRecursiveExt for EntityCommands<'w, 's, 'a> {
104104

105105
impl<'w> DespawnRecursiveExt for EntityMut<'w> {
106106
/// Despawns the provided entity and its children.
107-
fn despawn_recursive(mut self) {
107+
fn despawn_recursive(self) {
108108
let entity = self.id();
109109

110110
#[cfg(feature = "trace")]
@@ -114,11 +114,7 @@ impl<'w> DespawnRecursiveExt for EntityMut<'w> {
114114
)
115115
.entered();
116116

117-
// SAFETY: EntityMut is consumed so even though the location is no longer
118-
// valid, it cannot be accessed again with the invalid location.
119-
unsafe {
120-
despawn_with_children_recursive(self.world_mut(), entity);
121-
}
117+
despawn_with_children_recursive(self.into_world_mut(), entity);
122118
}
123119

124120
fn despawn_descendants(&mut self) {

0 commit comments

Comments
 (0)