Skip to content

Commit a1a4b07

Browse files
committed
s/DetectChanges/DetectChangesMut/ and doing the SAFETY comment the 'right' way
1 parent 478cdc1 commit a1a4b07

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

crates/bevy_ecs/src/change_detection.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ macro_rules! impl_methods {
241241
#[doc = stringify!($name)]
242242
/// <T>`, but you need a `Mut<T>`.
243243
///
244-
/// Note that calling [`DetectChanges::set_last_changed`] on the returned value
244+
/// Note that calling [`DetectChangesMut::set_last_changed`] on the returned value
245245
/// will not affect the original.
246246
pub fn reborrow(&mut self) -> Mut<'_, $target> {
247247
Mut {
@@ -606,7 +606,7 @@ impl<'a> MutUntyped<'a> {
606606
/// Returns a [`MutUntyped`] with a smaller lifetime.
607607
/// This is useful if you have `&mut MutUntyped`, but you need a `MutUntyped`.
608608
///
609-
/// Note that calling [`DetectChanges::set_last_changed`] on the returned value
609+
/// Note that calling [`DetectChangesMut::set_last_changed`] on the returned value
610610
/// will not affect the original.
611611
#[inline]
612612
pub fn reborrow(&mut self) -> MutUntyped {

crates/bevy_ecs/src/world/mod.rs

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

1592-
let ticks = unsafe {
1592+
let ticks =
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-
TicksMut::from_tick_cells(ticks, self.last_change_tick(), change_tick)
1597-
};
1596+
unsafe { TicksMut::from_tick_cells(ticks, self.last_change_tick(), change_tick) };
15981597

15991598
Some(MutUntyped {
16001599
// SAFETY: This function has exclusive access to the world so nothing aliases `ptr`.
@@ -1634,12 +1633,11 @@ impl World {
16341633
let change_tick = self.change_tick();
16351634
let (ptr, ticks) = self.get_non_send_with_ticks(component_id)?;
16361635

1637-
let ticks = unsafe {
1636+
let ticks =
16381637
// SAFETY: This function has exclusive access to the world so nothing aliases `ticks`.
16391638
// - index is in-bounds because the column is initialized and non-empty
16401639
// - 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-
};
1640+
unsafe { TicksMut::from_tick_cells(ticks, self.last_change_tick(), change_tick) };
16431641

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

0 commit comments

Comments
 (0)