Skip to content

Commit 9319c56

Browse files
committed
Fix lint errors
1 parent 327e12d commit 9319c56

File tree

1 file changed

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

1 file changed

+9
-3
lines changed

crates/bevy_ecs/src/world/mod.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2997,11 +2997,13 @@ mod tests {
29972997

29982998
let (info, ptr) = iter.next().unwrap();
29992999
assert_eq!(info.name(), std::any::type_name::<TestResource>());
3000+
// SAFETY: We know that the resource is of type `TestResource`
30003001
assert_eq!(unsafe { ptr.deref::<TestResource>().0 }, 42);
30013002

30023003
let (info, ptr) = iter.next().unwrap();
30033004
assert_eq!(info.name(), std::any::type_name::<TestResource2>());
30043005
assert_eq!(
3006+
// SAFETY: We know that the resource is of type `TestResource2`
30053007
unsafe { &ptr.deref::<TestResource2>().0 },
30063008
&"Hello, world!".to_string()
30073009
);
@@ -3020,13 +3022,17 @@ mod tests {
30203022

30213023
let (info, mut mut_untyped) = iter.next().unwrap();
30223024
assert_eq!(info.name(), std::any::type_name::<TestResource>());
3023-
unsafe { mut_untyped.as_mut().deref_mut::<TestResource>().0 = 43 };
3025+
// SAFETY: We know that the resource is of type `TestResource`
3026+
unsafe {
3027+
mut_untyped.as_mut().deref_mut::<TestResource>().0 = 43;
3028+
}
30243029

30253030
let (info, mut mut_untyped) = iter.next().unwrap();
30263031
assert_eq!(info.name(), std::any::type_name::<TestResource2>());
3032+
// SAFETY: We know that the resource is of type `TestResource2`
30273033
unsafe {
3028-
mut_untyped.as_mut().deref_mut::<TestResource2>().0 = "Hello, world?".to_string()
3029-
};
3034+
mut_untyped.as_mut().deref_mut::<TestResource2>().0 = "Hello, world?".to_string();
3035+
}
30303036

30313037
assert!(iter.next().is_none());
30323038

0 commit comments

Comments
 (0)