add must_use to register_component_hooks (#19945)
# Objective - I accidentally left a `register_component_hooks` without actually adding a hook and didnt notice ## Solution - mark it must_use so it doesnt happen to other people (maybe this is just skill issue on me though)
This commit is contained in:
parent
58feca9b32
commit
1380a3b7f2
@ -304,6 +304,7 @@ impl World {
|
||||
/// Returns a mutable reference to the [`ComponentHooks`] for a [`Component`] type.
|
||||
///
|
||||
/// Will panic if `T` exists in any archetypes.
|
||||
#[must_use]
|
||||
pub fn register_component_hooks<T: Component>(&mut self) -> &mut ComponentHooks {
|
||||
let index = self.register_component::<T>();
|
||||
assert!(!self.archetypes.archetypes.iter().any(|a| a.contains(index)), "Components hooks cannot be modified if the component already exists in an archetype, use register_component if {} may already be in use", core::any::type_name::<T>());
|
||||
|
Loading…
Reference in New Issue
Block a user