Fix an incorrect safety comment in World::get_resource (#6764)

# Objective

* Fix #6307

## Solution

* Rewrite the safety comment to reflect the actual invariants being asserted.
This commit is contained in:
JoJoJet 2022-11-28 13:40:26 +00:00
parent 70d7f80564
commit 1615834536

View file

@ -889,7 +889,7 @@ impl World {
#[inline]
pub fn get_resource<R: Resource>(&self) -> Option<&R> {
let component_id = self.components.get_resource_id(TypeId::of::<R>())?;
// SAFETY: unique world access
// SAFETY: `component_id` was obtained from the type ID of `R`.
unsafe { self.get_resource_with_id(component_id) }
}