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)
This commit is contained in:
Derick M 2024-11-04 10:41:07 -05:00 committed by GitHub
parent 3c2830d607
commit 8d24efe60c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -487,7 +487,7 @@ impl ComponentHooks {
/// Will panic if the component already has an `on_add` hook /// Will panic if the component already has an `on_add` hook
pub fn on_add(&mut self, hook: ComponentHook) -> &mut Self { pub fn on_add(&mut self, hook: ComponentHook) -> &mut Self {
self.try_on_add(hook) 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`) /// 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 /// Will panic if the component already has an `on_insert` hook
pub fn on_insert(&mut self, hook: ComponentHook) -> &mut Self { pub fn on_insert(&mut self, hook: ComponentHook) -> &mut Self {
self.try_on_insert(hook) 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, /// 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 /// Will panic if the component already has an `on_replace` hook
pub fn on_replace(&mut self, hook: ComponentHook) -> &mut Self { pub fn on_replace(&mut self, hook: ComponentHook) -> &mut Self {
self.try_on_replace(hook) 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. /// 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 /// Will panic if the component already has an `on_remove` hook
pub fn on_remove(&mut self, hook: ComponentHook) -> &mut Self { pub fn on_remove(&mut self, hook: ComponentHook) -> &mut Self {
self.try_on_remove(hook) 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. /// Attempt to register a [`ComponentHook`] that will be run when this component is added to an entity.