Skip to content

Commit

Permalink
Tigher unsafe block scope
Browse files Browse the repository at this point in the history
  • Loading branch information
alice-i-cecile committed Jan 16, 2023
1 parent 8dd4303 commit 50538bf
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions crates/bevy_ecs/src/world/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,11 +317,9 @@ impl World {
pub fn get_entity(&self, entity: Entity) -> Option<EntityRef> {
let location = self.entities.get(entity)?;
// SAFETY: if the Entity is invalid, the function returns early.
// Additionally, Entities::get(entity) returns the correct EntityLocation if the entity exists
unsafe {
let entity_ref = EntityRef::new(self, entity, location);
Some(entity_ref)
}
// Additionally, Entities::get(entity) returns the correct EntityLocation if the entity exists.
let entity_ref = unsafe { EntityRef::new(self, entity, location) };
Some(entity_ref)
}

/// Returns an [`Entity`] iterator of current entities.
Expand Down

0 comments on commit 50538bf

Please sign in to comment.