Skip to content

Commit

Permalink
Use slice in init_dynamic_info
Browse files Browse the repository at this point in the history
Fix lint
  • Loading branch information
Suficio committed Jan 29, 2023
1 parent 360e855 commit 0306cf5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions crates/bevy_ecs/src/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ impl Bundles {
pub(crate) fn init_dynamic_info(
&mut self,
components: &mut Components,
component_ids: &Vec<ComponentId>,
component_ids: &[ComponentId],
) -> (&BundleInfo, &Vec<StorageType>) {
let bundle_infos = &mut self.bundle_infos;

Expand All @@ -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)),
)
});

Expand Down
10 changes: 5 additions & 5 deletions crates/bevy_ecs/src/world/entity_ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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<Item = OwningPtr<'a>>>(
&mut self,
component_ids: &Vec<ComponentId>,
component_ids: &[ComponentId],
iter_components: I,
) -> &mut Self {
let change_tick = self.world.change_tick();
Expand Down Expand Up @@ -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();
Expand All @@ -1110,7 +1110,7 @@ mod tests {
let test_component_id = world.init_component::<TestComponent>();
let test_component_2_id = world.init_component::<TestComponent2>();

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);

Expand Down

0 comments on commit 0306cf5

Please sign in to comment.