Skip to content

Commit 336049d

Browse files
committed
Remove outdated uses of single-tuple bundles (#6406)
# Objective Bevy still has many instances of using single-tuples `(T,)` to create a bundle. Due to #2975, this is no longer necessary. ## Solution Search for regex `\(.+\s*,\)`. This should have found every instance.
1 parent dfb80ee commit 336049d

File tree

9 files changed

+25
-25
lines changed

9 files changed

+25
-25
lines changed

benches/benches/bevy_ecs/components/add_remove.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ impl Benchmark {
1212
let mut world = World::default();
1313

1414
let entities = world
15-
.spawn_batch((0..10000).map(|_| (A(0.0),)))
15+
.spawn_batch((0..10000).map(|_| A(0.0)))
1616
.collect::<Vec<_>>();
1717

1818
Self(world, entities)

benches/benches/bevy_ecs/world/world_get.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ fn deterministic_rand() -> ChaCha8Rng {
3131

3232
fn setup<T: Component + Default>(entity_count: u32) -> World {
3333
let mut world = World::default();
34-
world.spawn_batch((0..entity_count).map(|_| (T::default(),)));
34+
world.spawn_batch((0..entity_count).map(|_| T::default()));
3535
black_box(world)
3636
}
3737

@@ -308,7 +308,7 @@ pub fn query_get_component(criterion: &mut Criterion) {
308308
group.bench_function(format!("{}_entities_table", entity_count), |bencher| {
309309
let mut world = World::default();
310310
let mut entities: Vec<_> = world
311-
.spawn_batch((0..entity_count).map(|_| (Table::default(),)))
311+
.spawn_batch((0..entity_count).map(|_| Table::default()))
312312
.collect();
313313
entities.shuffle(&mut deterministic_rand());
314314
let mut query = SystemState::<Query<&Table>>::new(&mut world);
@@ -330,7 +330,7 @@ pub fn query_get_component(criterion: &mut Criterion) {
330330
group.bench_function(format!("{}_entities_sparse", entity_count), |bencher| {
331331
let mut world = World::default();
332332
let mut entities: Vec<_> = world
333-
.spawn_batch((0..entity_count).map(|_| (Sparse::default(),)))
333+
.spawn_batch((0..entity_count).map(|_| Sparse::default()))
334334
.collect();
335335
entities.shuffle(&mut deterministic_rand());
336336
let mut query = SystemState::<Query<&Sparse>>::new(&mut world);
@@ -363,7 +363,7 @@ pub fn query_get(criterion: &mut Criterion) {
363363
group.bench_function(format!("{}_entities_table", entity_count), |bencher| {
364364
let mut world = World::default();
365365
let mut entities: Vec<_> = world
366-
.spawn_batch((0..entity_count).map(|_| (Table::default(),)))
366+
.spawn_batch((0..entity_count).map(|_| Table::default()))
367367
.collect();
368368
entities.shuffle(&mut deterministic_rand());
369369
let mut query = SystemState::<Query<&Table>>::new(&mut world);

crates/bevy_ecs/src/query/mod.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ mod tests {
9797

9898
let mut world = World::new();
9999
world.spawn((A(1), B(1)));
100-
world.spawn((A(2),));
101-
world.spawn((A(3),));
100+
world.spawn(A(2));
101+
world.spawn(A(3));
102102

103103
assert_all_sizes_equal::<&A, With<B>>(&mut world, 1);
104104
assert_all_sizes_equal::<&A, Without<B>>(&mut world, 2);
@@ -110,10 +110,10 @@ mod tests {
110110
world.spawn((A(4), C(4)));
111111
world.spawn((A(5), C(5)));
112112
world.spawn((A(6), C(6)));
113-
world.spawn((A(7),));
114-
world.spawn((A(8),));
115-
world.spawn((A(9),));
116-
world.spawn((A(10),));
113+
world.spawn(A(7));
114+
world.spawn(A(8));
115+
world.spawn(A(9));
116+
world.spawn(A(10));
117117

118118
// With/Without for B and C
119119
assert_all_sizes_equal::<&A, With<B>>(&mut world, 3);
@@ -444,7 +444,7 @@ mod tests {
444444
fn query_iter_combinations_sparse() {
445445
let mut world = World::new();
446446

447-
world.spawn_batch((1..=4).map(|i| (Sparse(i),)));
447+
world.spawn_batch((1..=4).map(Sparse));
448448

449449
let mut query = world.query::<&mut Sparse>();
450450
let mut combinations = query.iter_combinations_mut(&mut world);

crates/bevy_hierarchy/src/child_builder.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ mod tests {
632632
fn push_and_insert_and_remove_children_commands() {
633633
let mut world = World::default();
634634
let entities = world
635-
.spawn_batch(vec![(C(1),), (C(2),), (C(3),), (C(4),), (C(5),)])
635+
.spawn_batch(vec![C(1), C(2), C(3), C(4), C(5)])
636636
.collect::<Vec<Entity>>();
637637

638638
let mut queue = CommandQueue::default();
@@ -693,7 +693,7 @@ mod tests {
693693
fn push_and_insert_and_remove_children_world() {
694694
let mut world = World::default();
695695
let entities = world
696-
.spawn_batch(vec![(C(1),), (C(2),), (C(3),), (C(4),), (C(5),)])
696+
.spawn_batch(vec![C(1), C(2), C(3), C(4), C(5)])
697697
.collect::<Vec<Entity>>();
698698

699699
world.entity_mut(entities[0]).push_children(&entities[1..3]);
@@ -737,7 +737,7 @@ mod tests {
737737
fn children_removed_when_empty_world() {
738738
let mut world = World::default();
739739
let entities = world
740-
.spawn_batch(vec![(C(1),), (C(2),), (C(3),)])
740+
.spawn_batch(vec![C(1), C(2), C(3)])
741741
.collect::<Vec<Entity>>();
742742

743743
let parent1 = entities[0];
@@ -769,7 +769,7 @@ mod tests {
769769
fn children_removed_when_empty_commands() {
770770
let mut world = World::default();
771771
let entities = world
772-
.spawn_batch(vec![(C(1),), (C(2),), (C(3),)])
772+
.spawn_batch(vec![C(1), C(2), C(3)])
773773
.collect::<Vec<Entity>>();
774774

775775
let parent1 = entities[0];

crates/bevy_pbr/src/render/mesh.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ pub fn extract_skinned_meshes(
239239
SkinnedMeshJoints::build(skin, &inverse_bindposes, &joint_query, &mut joints)
240240
{
241241
last_start = last_start.max(skinned_joints.index as usize);
242-
values.push((entity, (skinned_joints.to_buffer_index(),)));
242+
values.push((entity, skinned_joints.to_buffer_index()));
243243
}
244244
}
245245

crates/bevy_render/src/extract_component.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,10 @@ fn prepare_uniform_components<C: Component>(
115115
.map(|(entity, component)| {
116116
(
117117
entity,
118-
(DynamicUniformIndex::<C> {
118+
DynamicUniformIndex::<C> {
119119
index: component_uniforms.uniforms.push(component.clone()),
120120
marker: PhantomData,
121-
},),
121+
},
122122
)
123123
})
124124
.collect::<Vec<_>>();
@@ -187,7 +187,7 @@ fn extract_components<C: ExtractComponent>(
187187
) {
188188
let mut values = Vec::with_capacity(*previous_len);
189189
for (entity, query_item) in &query {
190-
values.push((entity, (C::extract_component(query_item),)));
190+
values.push((entity, C::extract_component(query_item)));
191191
}
192192
*previous_len = values.len();
193193
commands.insert_or_spawn_batch(values);
@@ -202,7 +202,7 @@ fn extract_visible_components<C: ExtractComponent>(
202202
let mut values = Vec::with_capacity(*previous_len);
203203
for (entity, computed_visibility, query_item) in &query {
204204
if computed_visibility.is_visible() {
205-
values.push((entity, (C::extract_component(query_item),)));
205+
values.push((entity, C::extract_component(query_item)));
206206
}
207207
}
208208
*previous_len = values.len();

crates/bevy_sprite/src/render/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ pub fn queue_sprites(
555555
{
556556
current_batch = new_batch;
557557
current_image_size = Vec2::new(gpu_image.size.x, gpu_image.size.y);
558-
current_batch_entity = commands.spawn((current_batch,)).id();
558+
current_batch_entity = commands.spawn(current_batch).id();
559559

560560
image_bind_groups
561561
.values

crates/bevy_ui/src/render/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,11 +425,11 @@ pub fn prepare_uinodes(
425425
for extracted_uinode in &extracted_uinodes.uinodes {
426426
if current_batch_handle != extracted_uinode.image {
427427
if start != end {
428-
commands.spawn((UiBatch {
428+
commands.spawn(UiBatch {
429429
range: start..end,
430430
image: current_batch_handle,
431431
z: last_z,
432-
},));
432+
});
433433
start = end;
434434
}
435435
current_batch_handle = extracted_uinode.image.clone_weak();

examples/2d/mesh2d_manual.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ pub fn extract_colored_mesh2d(
300300
if !computed_visibility.is_visible() {
301301
continue;
302302
}
303-
values.push((entity, (ColoredMesh2d,)));
303+
values.push((entity, ColoredMesh2d));
304304
}
305305
*previous_len = values.len();
306306
commands.insert_or_spawn_batch(values);

0 commit comments

Comments
 (0)