From b3bc691aedb46519e36db8e9eba0e37ac3cefb4a Mon Sep 17 00:00:00 2001 From: HampusM Date: Wed, 15 Oct 2025 15:34:21 +0200 Subject: refactor(ecs): make fn arg to insert_at_part_pt_by_key return ref --- ecs/src/component/storage.rs | 4 ++-- ecs/src/event.rs | 4 ++-- ecs/src/util.rs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'ecs') diff --git a/ecs/src/component/storage.rs b/ecs/src/component/storage.rs index 86e124f..a8711c5 100644 --- a/ecs/src/component/storage.rs +++ b/ecs/src/component/storage.rs @@ -644,7 +644,7 @@ impl<'component_storage> Iterator for ArchetypeRefIter<'component_storage, '_> add_edge_archetype_comps .insert_at_part_pt_by_key(add_edge_component_id, |comp_id| { - *comp_id + comp_id }); self.storage.imaginary_archetypes.borrow_mut().push( @@ -712,7 +712,7 @@ impl ArchetypeRefIter<'_, '_> let mut add_edge_comp_ids = imaginary_archetype_comps.to_vec(); - add_edge_comp_ids.insert_at_part_pt_by_key(unique_comp_id, |id| *id); + add_edge_comp_ids.insert_at_part_pt_by_key(unique_comp_id, |id| id); let add_edge = ArchetypeId::new(&add_edge_comp_ids); diff --git a/ecs/src/event.rs b/ecs/src/event.rs index dffd327..15455b6 100644 --- a/ecs/src/event.rs +++ b/ecs/src/event.rs @@ -70,7 +70,7 @@ impl NewEvents self.events.insert_at_part_pt_by_key( (event_id, Matches { match_ids: Vec::from([match_id]) }), - |(other_event_id, _)| *other_event_id, + |(other_event_id, _)| other_event_id, ); } @@ -100,6 +100,6 @@ impl Matches } self.match_ids - .insert_at_part_pt_by_key(match_id, |other_match_id| *other_match_id); + .insert_at_part_pt_by_key(match_id, |other_match_id| other_match_id); } } diff --git a/ecs/src/util.rs b/ecs/src/util.rs index dc670e7..c18fd49 100644 --- a/ecs/src/util.rs +++ b/ecs/src/util.rs @@ -11,7 +11,7 @@ pub trait VecExt fn insert_at_part_pt_by_key( &mut self, item: Item, - func: impl FnMut(&Item) -> Key, + func: impl FnMut(&Item) -> &Key, ) where Key: Ord; } @@ -21,7 +21,7 @@ impl VecExt for Vec fn insert_at_part_pt_by_key( &mut self, item: Item, - mut func: impl FnMut(&Item) -> Key, + mut func: impl FnMut(&Item) -> &Key, ) where Key: Ord, { -- cgit v1.2.3-18-g5258