@@ -80,10 +80,10 @@ impl<'w> Drop for WorldCell<'w> {
80
80
let mut access = self . access . borrow_mut ( ) ;
81
81
82
82
{
83
- // SAFETY: we only swap `archetype_component_access`
84
- let world = unsafe { self . world . world ( ) } ;
85
- // SAFETY: the WorldCell has exclusive world access
86
- let world_cached_access = unsafe { & mut * world. archetype_component_access . get ( ) } ;
83
+ // SAFETY: `WorldCell` does not hand out `UnsafeWorldCell` to anywhere else so this is the only
84
+ // `UnsafeWorldCell` and we have exclusive access to it.
85
+ let world = unsafe { self . world . world_mut ( ) } ;
86
+ let world_cached_access = & mut world. archetype_component_access ;
87
87
88
88
// give world ArchetypeComponentAccess back to reuse allocations
89
89
std:: mem:: swap ( world_cached_access, & mut * access) ;
@@ -185,7 +185,7 @@ impl<'w> WorldCell<'w> {
185
185
pub ( crate ) fn new ( world : & ' w mut World ) -> Self {
186
186
// this is cheap because ArchetypeComponentAccess::new() is const / allocation free
187
187
let access = std:: mem:: replace (
188
- world. archetype_component_access . get_mut ( ) ,
188
+ & mut world. archetype_component_access ,
189
189
ArchetypeComponentAccess :: new ( ) ,
190
190
) ;
191
191
// world's ArchetypeComponentAccess is recycled to cut down on allocations
@@ -435,11 +435,10 @@ mod tests {
435
435
let u32_archetype_component_id = world
436
436
. get_resource_archetype_component_id ( u32_component_id)
437
437
. unwrap ( ) ;
438
- assert_eq ! ( world. archetype_component_access. get_mut ( ) . access. len( ) , 1 ) ;
438
+ assert_eq ! ( world. archetype_component_access. access. len( ) , 1 ) ;
439
439
assert_eq ! (
440
440
world
441
441
. archetype_component_access
442
- . get_mut( )
443
442
. access
444
443
. get( u32_archetype_component_id) ,
445
444
Some ( & BASE_ACCESS ) ,
0 commit comments