diff --git a/crates/bevy_ecs/src/bundle.rs b/crates/bevy_ecs/src/bundle.rs index fe5acdc1a0e5d4..8e3d17f992500b 100644 --- a/crates/bevy_ecs/src/bundle.rs +++ b/crates/bevy_ecs/src/bundle.rs @@ -740,7 +740,7 @@ impl Bundles { pub(crate) fn init_dynamic_info( &mut self, components: &mut Components, - component_ids: &Vec, + component_ids: &[ComponentId], ) -> (&BundleInfo, &Vec) { let bundle_infos = &mut self.bundle_infos; @@ -751,8 +751,8 @@ impl Bundles { .from_key(component_ids) .or_insert_with(|| { ( - component_ids.clone(), - initialize_dynamic_bundle(bundle_infos, components, component_ids.clone()), + Vec::from(component_ids), + initialize_dynamic_bundle(bundle_infos, components, Vec::from(component_ids)), ) }); diff --git a/crates/bevy_ecs/src/world/entity_ref.rs b/crates/bevy_ecs/src/world/entity_ref.rs index 507b8b64ff3405..fd6367a73f5f6b 100644 --- a/crates/bevy_ecs/src/world/entity_ref.rs +++ b/crates/bevy_ecs/src/world/entity_ref.rs @@ -286,10 +286,10 @@ impl<'w> EntityMut<'w> { /// /// - [`ComponentId`] must be from the same world as [`EntityMut`] /// - [`OwningPtr`] must be a valid reference to the type represented by [`ComponentId`] - pub unsafe fn insert_by_id<'a>( + pub unsafe fn insert_by_id( &mut self, component_id: ComponentId, - component: OwningPtr<'a>, + component: OwningPtr<'_>, ) -> &mut Self { let change_tick = self.world.change_tick(); @@ -331,7 +331,7 @@ impl<'w> EntityMut<'w> { /// - Each [`OwningPtr`] must be a valid reference to the type represented by [`ComponentId`] pub unsafe fn insert_bundle_by_id<'a, I: Iterator>>( &mut self, - component_ids: &Vec, + component_ids: &[ComponentId], iter_components: I, ) -> &mut Self { let change_tick = self.world.change_tick(); @@ -1096,7 +1096,7 @@ mod tests { let mut entity = world.spawn_empty(); OwningPtr::make(TestComponent(84), |ptr| { // SAFETY: `ptr` matches the component id - unsafe { entity.insert_bundle_by_id(&vec![test_component_id], vec![ptr].into_iter()) }; + unsafe { entity.insert_bundle_by_id(&[test_component_id], vec![ptr].into_iter()) }; }); let components: Vec<_> = world.query::<&TestComponent>().iter(&world).collect(); @@ -1110,7 +1110,7 @@ mod tests { let test_component_id = world.init_component::(); let test_component_2_id = world.init_component::(); - let component_ids = vec![test_component_id, test_component_2_id]; + let component_ids = [test_component_id, test_component_2_id]; let test_component_value = TestComponent(42); let test_component_2_value = TestComponent2(84);