From 8d24efe60ccd2c201763b1b84513c47601140a1f Mon Sep 17 00:00:00 2001 From: Derick M <58572875+TurtIeSocks@users.noreply.github.com> Date: Mon, 4 Nov 2024 10:41:07 -0500 Subject: [PATCH] Remove unused debug identifiers for `ComponentHooks` methods (#16228) # Objective - Cleans up unused debug identifiers for `ComponentHooks` methods: `on_add`, `on_insert`, `on_replace`, and `on_remove` ## Solution - Simplify the expect messages by removing the unused `{:?}` ## Testing - Currently untested [Context](https://discord.com/channels/691052431525675048/749335865876021248/1302988180592525362) --- crates/bevy_ecs/src/component.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/bevy_ecs/src/component.rs b/crates/bevy_ecs/src/component.rs index c6a1abe75b..4c0323f2a5 100644 --- a/crates/bevy_ecs/src/component.rs +++ b/crates/bevy_ecs/src/component.rs @@ -487,7 +487,7 @@ impl ComponentHooks { /// Will panic if the component already has an `on_add` hook pub fn on_add(&mut self, hook: ComponentHook) -> &mut Self { self.try_on_add(hook) - .expect("Component id: {:?}, already has an on_add hook") + .expect("Component already has an on_add hook") } /// Register a [`ComponentHook`] that will be run when this component is added (with `.insert`) @@ -505,7 +505,7 @@ impl ComponentHooks { /// Will panic if the component already has an `on_insert` hook pub fn on_insert(&mut self, hook: ComponentHook) -> &mut Self { self.try_on_insert(hook) - .expect("Component id: {:?}, already has an on_insert hook") + .expect("Component already has an on_insert hook") } /// Register a [`ComponentHook`] that will be run when this component is about to be dropped, @@ -527,7 +527,7 @@ impl ComponentHooks { /// Will panic if the component already has an `on_replace` hook pub fn on_replace(&mut self, hook: ComponentHook) -> &mut Self { self.try_on_replace(hook) - .expect("Component id: {:?}, already has an on_replace hook") + .expect("Component already has an on_replace hook") } /// Register a [`ComponentHook`] that will be run when this component is removed from an entity. @@ -538,7 +538,7 @@ impl ComponentHooks { /// Will panic if the component already has an `on_remove` hook pub fn on_remove(&mut self, hook: ComponentHook) -> &mut Self { self.try_on_remove(hook) - .expect("Component id: {:?}, already has an on_remove hook") + .expect("Component already has an on_remove hook") } /// Attempt to register a [`ComponentHook`] that will be run when this component is added to an entity.