Skip to content

Commit 478cdc1

Browse files
committed
rustfmt + moving SAFETY into block to make it more readable (safety comment after = makes no sense to me)
1 parent 312691d commit 478cdc1

File tree

1 file changed

+9
-6
lines changed
  • crates/bevy_ecs/src/world

1 file changed

+9
-6
lines changed

crates/bevy_ecs/src/world/mod.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1589,11 +1589,12 @@ impl World {
15891589
let change_tick = self.change_tick();
15901590
let (ptr, ticks) = self.get_resource_with_ticks(component_id)?;
15911591

1592-
let ticks =
1592+
let ticks = unsafe {
15931593
// SAFETY: This function has exclusive access to the world so nothing aliases `ticks`.
15941594
// - index is in-bounds because the column is initialized and non-empty
15951595
// - no other reference to the ticks of the same row can exist at the same time
1596-
unsafe { TicksMut::from_tick_cells(ticks, self.last_change_tick(), change_tick) };
1596+
TicksMut::from_tick_cells(ticks, self.last_change_tick(), change_tick)
1597+
};
15971598

15981599
Some(MutUntyped {
15991600
// SAFETY: This function has exclusive access to the world so nothing aliases `ptr`.
@@ -1633,10 +1634,12 @@ impl World {
16331634
let change_tick = self.change_tick();
16341635
let (ptr, ticks) = self.get_non_send_with_ticks(component_id)?;
16351636

1636-
// SAFETY: This function has exclusive access to the world so nothing aliases `ticks`.
1637-
// - index is in-bounds because the column is initialized and non-empty
1638-
// - no other reference to the ticks of the same row can exist at the same time
1639-
let ticks = unsafe { TicksMut::from_tick_cells(ticks, self.last_change_tick(), change_tick) };
1637+
let ticks = unsafe {
1638+
// SAFETY: This function has exclusive access to the world so nothing aliases `ticks`.
1639+
// - index is in-bounds because the column is initialized and non-empty
1640+
// - no other reference to the ticks of the same row can exist at the same time
1641+
TicksMut::from_tick_cells(ticks, self.last_change_tick(), change_tick)
1642+
};
16401643

16411644
Some(MutUntyped {
16421645
// SAFETY: This function has exclusive access to the world so nothing aliases `ptr`.

0 commit comments

Comments
 (0)