From 1380a3b7f2dfc865cd3cd3ad4b973e253ec56e40 Mon Sep 17 00:00:00 2001 From: atlv Date: Fri, 4 Jul 2025 12:24:46 -0400 Subject: [PATCH] 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) --- crates/bevy_ecs/src/world/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/bevy_ecs/src/world/mod.rs b/crates/bevy_ecs/src/world/mod.rs index 714c5e1eae..b4b475e463 100644 --- a/crates/bevy_ecs/src/world/mod.rs +++ b/crates/bevy_ecs/src/world/mod.rs @@ -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(&mut self) -> &mut ComponentHooks { let index = self.register_component::(); 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::());