From a66d59bd57e9764458f3c2e80ee487fc62811654 Mon Sep 17 00:00:00 2001 From: Joseph <21144246+JoJoJet@users.noreply.github.com> Date: Thu, 7 Sep 2023 22:44:58 -0700 Subject: [PATCH] remove useless single tuples and trailing commas --- benches/benches/bevy_ecs/change_detection.rs | 2 +- benches/benches/bevy_ecs/events/mod.rs | 2 +- benches/benches/bevy_ecs/world/world_get.rs | 2 +- crates/bevy_ecs/src/lib.rs | 16 +++++------ crates/bevy_hierarchy/src/child_builder.rs | 4 +-- crates/bevy_pbr/src/render/light.rs | 2 +- crates/bevy_reflect/src/serde/de.rs | 2 +- crates/bevy_render/src/color/mod.rs | 12 ++++---- crates/bevy_scene/src/serde.rs | 2 +- crates/bevy_time/src/time.rs | 12 ++++---- crates/bevy_ui/src/layout/convert.rs | 2 +- examples/3d/atmospheric_fog.rs | 28 ++++++++++--------- examples/ecs/component_change_detection.rs | 2 +- .../stress_tests/many_animated_sprites.rs | 2 +- examples/stress_tests/many_lights.rs | 2 +- examples/stress_tests/many_sprites.rs | 2 +- examples/ui/display_and_visibility.rs | 28 +++++++++---------- examples/ui/ui_texture_atlas.rs | 4 +-- 18 files changed, 64 insertions(+), 62 deletions(-) diff --git a/benches/benches/bevy_ecs/change_detection.rs b/benches/benches/bevy_ecs/change_detection.rs index fb800c921cee2..7fc3f5a2a9b69 100644 --- a/benches/benches/bevy_ecs/change_detection.rs +++ b/benches/benches/bevy_ecs/change_detection.rs @@ -51,7 +51,7 @@ fn deterministic_rand() -> ChaCha8Rng { fn setup(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) } diff --git a/benches/benches/bevy_ecs/events/mod.rs b/benches/benches/bevy_ecs/events/mod.rs index 7e999ca07a52e..f7130594c6ed2 100644 --- a/benches/benches/bevy_ecs/events/mod.rs +++ b/benches/benches/bevy_ecs/events/mod.rs @@ -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"); diff --git a/benches/benches/bevy_ecs/world/world_get.rs b/benches/benches/bevy_ecs/world/world_get.rs index 725e9b2cf39f5..1aba723802b0f 100644 --- a/benches/benches/bevy_ecs/world/world_get.rs +++ b/benches/benches/bevy_ecs/world/world_get.rs @@ -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::>::new(&mut world); diff --git a/crates/bevy_ecs/src/lib.rs b/crates/bevy_ecs/src/lib.rs index ebc8b15fbb990..06001b584dbdc 100644 --- a/crates/bevy_ecs/src/lib.rs +++ b/crates/bevy_ecs/src/lib.rs @@ -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, Without)],); - assert_eq!(3, query_min_size![&B, Or<(With, With)>],); - assert_eq!(1, query_min_size![&B, (With, With)],); - assert_eq!(1, query_min_size![(&A, &B), With],); + assert_eq!(2, query_min_size![(), (With, Without)]); + assert_eq!(3, query_min_size![&B, Or<(With, With)>]); + assert_eq!(1, query_min_size![&B, (With, With)]); + assert_eq!(1, query_min_size![(&A, &B), With]); assert_eq!(4, query_min_size![&A, ()], "Simple Archetypal"); - assert_eq!(4, query_min_size![Ref, ()],); + assert_eq!(4, query_min_size![Ref, ()]); // 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], "Simple Added"); assert_eq!(0, query_min_size![(), Changed], "Simple Changed"); - assert_eq!(0, query_min_size![(&A, &B), Changed],); - assert_eq!(0, query_min_size![&A, (Changed, With)],); - assert_eq!(0, query_min_size![(&A, &B), Or<(Changed, Changed)>],); + assert_eq!(0, query_min_size![(&A, &B), Changed]); + assert_eq!(0, query_min_size![&A, (Changed, With)]); + assert_eq!(0, query_min_size![(&A, &B), Or<(Changed, Changed)>]); } #[test] diff --git a/crates/bevy_hierarchy/src/child_builder.rs b/crates/bevy_hierarchy/src/child_builder.rs index da52ac385faf2..06a522a228b59 100644 --- a/crates/bevy_hierarchy/src/child_builder.rs +++ b/crates/bevy_hierarchy/src/child_builder.rs @@ -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::>(); let mut queue = CommandQueue::default(); @@ -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::>(); let mut queue = CommandQueue::default(); diff --git a/crates/bevy_pbr/src/render/light.rs b/crates/bevy_pbr/src/render/light.rs index 4e708e454a912..a9d0cef47a7b6 100644 --- a/crates/bevy_pbr/src/render/light.rs +++ b/crates/bevy_pbr/src/render/light.rs @@ -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( diff --git a/crates/bevy_reflect/src/serde/de.rs b/crates/bevy_reflect/src/serde/de.rs index 49fbbb5fa1bdb..a59ae5ec3303b 100644 --- a/crates/bevy_reflect/src/serde/de.rs +++ b/crates/bevy_reflect/src/serde/de.rs @@ -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) } diff --git a/crates/bevy_render/src/color/mod.rs b/crates/bevy_render/src/color/mod.rs index deb642a131396..3643439383bda 100644 --- a/crates/bevy_render/src/color/mod.rs +++ b/crates/bevy_render/src/color/mod.rs @@ -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); @@ -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] @@ -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] @@ -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] @@ -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] @@ -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 diff --git a/crates/bevy_scene/src/serde.rs b/crates/bevy_scene/src/serde.rs index e8d2d6a2841b1..c91d8084ff2db 100644 --- a/crates/bevy_scene/src/serde.rs +++ b/crates/bevy_scene/src/serde.rs @@ -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 diff --git a/crates/bevy_time/src/time.rs b/crates/bevy_time/src/time.rs index 260910c46bde8..c2d23146b997d 100644 --- a/crates/bevy_time/src/time.rs +++ b/crates/bevy_time/src/time.rs @@ -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(), @@ -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(), @@ -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(), @@ -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(), @@ -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(), @@ -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(), diff --git a/crates/bevy_ui/src/layout/convert.rs b/crates/bevy_ui/src/layout/convert.rs index ce424ba44e3a7..fcb164052e089 100644 --- a/crates/bevy_ui/src/layout/convert.rs +++ b/crates/bevy_ui/src/layout/convert.rs @@ -620,7 +620,7 @@ mod tests { | (LengthPercentage::Percent(a), LengthPercentage::Percent(b)) => (a - b).abs() < 0.0001, _ => false, - },); + }); } } } diff --git a/examples/3d/atmospheric_fog.rs b/examples/3d/atmospheric_fog.rs index cce9de5d8d6ba..a8cf9199f9f93 100644 --- a/examples/3d/atmospheric_fog.rs +++ b/examples/3d/atmospheric_fog.rs @@ -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>, mut fog: Query<&mut FogSettings>) { diff --git a/examples/ecs/component_change_detection.rs b/examples/ecs/component_change_detection.rs index 4356fd10314c4..234a7021e9cea 100644 --- a/examples/ecs/component_change_detection.rs +++ b/examples/ecs/component_change_detection.rs @@ -40,7 +40,7 @@ fn change_component(time: Res