Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove useless single tuples and trailing commas #9720

Merged
merged 1 commit into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion benches/benches/bevy_ecs/change_detection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ fn deterministic_rand() -> ChaCha8Rng {

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

Expand Down
2 changes: 1 addition & 1 deletion benches/benches/bevy_ecs/events/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use criterion::*;
mod iter;
mod send;

criterion_group!(event_benches, send, iter,);
criterion_group!(event_benches, send, iter);

fn send(c: &mut Criterion) {
let mut group = c.benchmark_group("events_send");
Expand Down
2 changes: 1 addition & 1 deletion benches/benches/bevy_ecs/world/world_get.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ pub fn query_get(criterion: &mut Criterion) {
group.bench_function(format!("{}_entities_sparse", entity_count), |bencher| {
let mut world = World::default();
let mut entities: Vec<_> = world
.spawn_batch((0..entity_count).map(|_| (Sparse::default(),)))
.spawn_batch((0..entity_count).map(|_| Sparse::default()))
.collect();
entities.shuffle(&mut deterministic_rand());
let mut query = SystemState::<Query<&Sparse>>::new(&mut world);
Expand Down
16 changes: 8 additions & 8 deletions crates/bevy_ecs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1529,19 +1529,19 @@ mod tests {
world.spawn((B(1), C));
world.spawn(A(1));
world.spawn(C);
assert_eq!(2, query_min_size![(), (With<A>, Without<B>)],);
assert_eq!(3, query_min_size![&B, Or<(With<A>, With<C>)>],);
assert_eq!(1, query_min_size![&B, (With<A>, With<C>)],);
assert_eq!(1, query_min_size![(&A, &B), With<C>],);
assert_eq!(2, query_min_size![(), (With<A>, Without<B>)]);
assert_eq!(3, query_min_size![&B, Or<(With<A>, With<C>)>]);
assert_eq!(1, query_min_size![&B, (With<A>, With<C>)]);
assert_eq!(1, query_min_size![(&A, &B), With<C>]);
assert_eq!(4, query_min_size![&A, ()], "Simple Archetypal");
assert_eq!(4, query_min_size![Ref<A>, ()],);
assert_eq!(4, query_min_size![Ref<A>, ()]);
// All the following should set minimum size to 0, as it's impossible to predict
// how many entities the filters will trim.
assert_eq!(0, query_min_size![(), Added<A>], "Simple Added");
assert_eq!(0, query_min_size![(), Changed<A>], "Simple Changed");
assert_eq!(0, query_min_size![(&A, &B), Changed<A>],);
assert_eq!(0, query_min_size![&A, (Changed<A>, With<B>)],);
assert_eq!(0, query_min_size![(&A, &B), Or<(Changed<A>, Changed<B>)>],);
assert_eq!(0, query_min_size![(&A, &B), Changed<A>]);
assert_eq!(0, query_min_size![&A, (Changed<A>, With<B>)]);
assert_eq!(0, query_min_size![(&A, &B), Or<(Changed<A>, Changed<B>)>]);
}

#[test]
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_hierarchy/src/child_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ mod tests {
fn push_and_clear_children_commands() {
let mut world = World::default();
let entities = world
.spawn_batch(vec![(C(1),), (C(2),), (C(3),), (C(4),), (C(5),)])
.spawn_batch(vec![C(1), C(2), C(3), C(4), C(5)])
.collect::<Vec<Entity>>();

let mut queue = CommandQueue::default();
Expand Down Expand Up @@ -942,7 +942,7 @@ mod tests {
fn push_and_replace_children_commands() {
let mut world = World::default();
let entities = world
.spawn_batch(vec![(C(1),), (C(2),), (C(3),), (C(4),), (C(5),)])
.spawn_batch(vec![C(1), C(2), C(3), C(4), C(5)])
.collect::<Vec<Entity>>();

let mut queue = CommandQueue::default();
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_pbr/src/render/light.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1063,7 +1063,7 @@ pub fn prepare_lights(
.spawn((
ShadowView {
depth_texture_view,
pass_name: format!("shadow pass spot light {light_index}",),
pass_name: format!("shadow pass spot light {light_index}"),
},
ExtractedView {
viewport: UVec4::new(
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_reflect/src/serde/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1078,7 +1078,7 @@ fn get_registration<'a, E: Error>(
registry: &'a TypeRegistry,
) -> Result<&'a TypeRegistration, E> {
let registration = registry.get(type_id).ok_or_else(|| {
Error::custom(format_args!("no registration found for type `{type_name}`",))
Error::custom(format_args!("no registration found for type `{type_name}`"))
})?;
Ok(registration)
}
Expand Down
12 changes: 6 additions & 6 deletions crates/bevy_render/src/color/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1892,7 +1892,7 @@ mod tests {
let starting_vec4 = Vec4::new(0.4, 0.5, 0.6, 1.0);
let starting_color = Color::from(starting_vec4);

assert_eq!(starting_vec4, Vec4::from(starting_color),);
assert_eq!(starting_vec4, Vec4::from(starting_color));

let transformation = Vec4::new(0.5, 0.5, 0.5, 1.0);

Expand All @@ -1915,7 +1915,7 @@ mod tests {
let mut mutated_color = starting_color;
mutated_color *= transformation;

assert_eq!(starting_color * transformation, mutated_color,);
assert_eq!(starting_color * transformation, mutated_color);
}

#[test]
Expand All @@ -1931,7 +1931,7 @@ mod tests {
let mut mutated_color = starting_color;
mutated_color *= transformation;

assert_eq!(starting_color * transformation, mutated_color,);
assert_eq!(starting_color * transformation, mutated_color);
}

#[test]
Expand All @@ -1947,7 +1947,7 @@ mod tests {
let mut mutated_color = starting_color;
mutated_color *= transformation;

assert_eq!(starting_color * transformation, mutated_color,);
assert_eq!(starting_color * transformation, mutated_color);
}

#[test]
Expand All @@ -1963,7 +1963,7 @@ mod tests {
let mut mutated_color = starting_color;
mutated_color *= transformation;

assert_eq!(starting_color * transformation, mutated_color,);
assert_eq!(starting_color * transformation, mutated_color);
}

#[test]
Expand All @@ -1979,7 +1979,7 @@ mod tests {
let mut mutated_color = starting_color;
mutated_color *= transformation;

assert_eq!(starting_color * transformation, mutated_color,);
assert_eq!(starting_color * transformation, mutated_color);
}

// regression test for https://github.com/bevyengine/bevy/pull/8040
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_scene/src/serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ mod tests {
.find(|dynamic_entity| dynamic_entity.entity == expected.entity)
.unwrap_or_else(|| panic!("missing entity (expected: `{:?}`)", expected.entity));

assert_eq!(expected.entity, received.entity, "entities did not match",);
assert_eq!(expected.entity, received.entity, "entities did not match");

for expected in &expected.components {
let received = received
Expand Down
12 changes: 6 additions & 6 deletions crates/bevy_time/src/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ mod tests {
assert_eq!(time.raw_delta(), Duration::ZERO);
assert_eq!(time.raw_delta_seconds(), 0.0);
assert_eq!(time.raw_delta_seconds_f64(), 0.0);
assert_eq!(time.elapsed(), first_update_instant - start_instant,);
assert_eq!(time.elapsed(), first_update_instant - start_instant);
assert_eq!(
time.elapsed_seconds(),
(first_update_instant - start_instant).as_secs_f32(),
Expand All @@ -493,7 +493,7 @@ mod tests {
time.elapsed_seconds_f64(),
(first_update_instant - start_instant).as_secs_f64(),
);
assert_eq!(time.raw_elapsed(), first_update_instant - start_instant,);
assert_eq!(time.raw_elapsed(), first_update_instant - start_instant);
assert_eq!(
time.raw_elapsed_seconds(),
(first_update_instant - start_instant).as_secs_f32(),
Expand Down Expand Up @@ -532,7 +532,7 @@ mod tests {
time.raw_delta_seconds_f64(),
(second_update_instant - first_update_instant).as_secs_f64(),
);
assert_eq!(time.elapsed(), second_update_instant - start_instant,);
assert_eq!(time.elapsed(), second_update_instant - start_instant);
assert_eq!(
time.elapsed_seconds(),
(second_update_instant - start_instant).as_secs_f32(),
Expand All @@ -541,7 +541,7 @@ mod tests {
time.elapsed_seconds_f64(),
(second_update_instant - start_instant).as_secs_f64(),
);
assert_eq!(time.raw_elapsed(), second_update_instant - start_instant,);
assert_eq!(time.raw_elapsed(), second_update_instant - start_instant);
assert_eq!(
time.raw_elapsed_seconds(),
(second_update_instant - start_instant).as_secs_f32(),
Expand Down Expand Up @@ -614,7 +614,7 @@ mod tests {
time.raw_delta_seconds_f64(),
(second_update_instant - first_update_instant).as_secs_f64(),
);
assert_eq!(time.elapsed(), second_update_instant - start_instant,);
assert_eq!(time.elapsed(), second_update_instant - start_instant);
assert_eq!(
time.elapsed_seconds(),
(second_update_instant - start_instant).as_secs_f32(),
Expand All @@ -623,7 +623,7 @@ mod tests {
time.elapsed_seconds_f64(),
(second_update_instant - start_instant).as_secs_f64(),
);
assert_eq!(time.raw_elapsed(), second_update_instant - start_instant,);
assert_eq!(time.raw_elapsed(), second_update_instant - start_instant);
assert_eq!(
time.raw_elapsed_seconds(),
(second_update_instant - start_instant).as_secs_f32(),
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_ui/src/layout/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ mod tests {
| (LengthPercentage::Percent(a), LengthPercentage::Percent(b)) =>
(a - b).abs() < 0.0001,
_ => false,
},);
});
}
}
}
28 changes: 15 additions & 13 deletions examples/3d/atmospheric_fog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,20 +94,22 @@ fn setup_terrain_scene(
}

fn setup_instructions(mut commands: Commands) {
commands.spawn((TextBundle::from_section(
"Press Spacebar to Toggle Atmospheric Fog.\nPress S to Toggle Directional Light Fog Influence.",
TextStyle {
font_size: 20.0,
color: Color::WHITE,
commands.spawn(
TextBundle::from_section(
"Press Spacebar to Toggle Atmospheric Fog.\nPress S to Toggle Directional Light Fog Influence.",
TextStyle {
font_size: 20.0,
color: Color::WHITE,
..default()
},
)
.with_style(Style {
position_type: PositionType::Absolute,
bottom: Val::Px(12.0),
left: Val::Px(12.0),
..default()
},
)
.with_style(Style {
position_type: PositionType::Absolute,
bottom: Val::Px(12.0),
left: Val::Px(12.0),
..default()
}),));
}),
);
}

fn toggle_system(keycode: Res<Input<KeyCode>>, mut fog: Query<&mut FogSettings>) {
Expand Down
2 changes: 1 addition & 1 deletion examples/ecs/component_change_detection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fn change_component(time: Res<Time>, mut query: Query<(Entity, &mut MyComponent)
// Only entities matching the filters will be in the query
fn change_detection(query: Query<(Entity, &MyComponent), Changed<MyComponent>>) {
for (entity, component) in &query {
info!("{:?} changed: {:?}", entity, component,);
info!("{:?} changed: {:?}", entity, component);
}
}

Expand Down
2 changes: 1 addition & 1 deletion examples/stress_tests/many_animated_sprites.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,6 @@ fn print_sprite_count(
timer.tick(time.delta());

if timer.just_finished() {
info!("Sprites: {}", sprites.iter().count(),);
info!("Sprites: {}", sprites.iter().count());
}
}
2 changes: 1 addition & 1 deletion examples/stress_tests/many_lights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ fn print_light_count(time: Res<Time>, mut timer: Local<PrintingTimer>, lights: Q
timer.0.tick(time.delta());

if timer.0.just_finished() {
info!("Lights: {}", lights.iter().len(),);
info!("Lights: {}", lights.iter().len());
}
}

Expand Down
2 changes: 1 addition & 1 deletion examples/stress_tests/many_sprites.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,6 @@ fn print_sprite_count(time: Res<Time>, mut timer: Local<PrintingTimer>, sprites:
timer.tick(time.delta());

if timer.just_finished() {
info!("Sprites: {}", sprites.iter().count(),);
info!("Sprites: {}", sprites.iter().count());
}
}
Loading