Skip to content

Commit

Permalink
Fix test and clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
cart committed Jan 18, 2025
1 parent ec626d6 commit 5851993
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion crates/bevy_ecs/src/relationship/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ pub trait Relationship: Component + Sized {
entity.queue(|mut entity: EntityWorldMut| {
if entity
.get::<Self::RelationshipTarget>()
.map_or(false, |t| t.is_empty())
.is_some_and(RelationshipTarget::is_empty)
{
entity.remove::<Self::RelationshipTarget>();
}
Expand Down
25 changes: 17 additions & 8 deletions crates/bevy_transform/src/systems.rs
Original file line number Diff line number Diff line change
Expand Up @@ -453,14 +453,23 @@ mod test {
app.world_mut()
.spawn(Transform::IDENTITY)
.add_children(&[child]);
let grandchild_parent = app.world().entity(grandchild).get::<Parent>().unwrap().0;
let child_parent = app.world().entity(child).get::<Parent>().unwrap().0;
app.world_mut()
.entity_mut(child)
.insert(Parent(grandchild_parent));
app.world_mut()
.entity_mut(grandchild)
.insert(Parent(child_parent));
core::mem::swap(
#[allow(unsafe_code)]
unsafe {
&mut *app
.world_mut()
.entity_mut(child)
.get_mut_assume_mutable::<Parent>()
.unwrap()
},
#[allow(unsafe_code)]
unsafe {
&mut *temp
.entity_mut(grandchild)
.get_mut_assume_mutable::<Parent>()
.unwrap()
},
);

app.update();
}
Expand Down

0 comments on commit 5851993

Please sign in to comment.