From 17480b2d8905fef51b73966b7e671f7be6a5ff76 Mon Sep 17 00:00:00 2001 From: James Liu Date: Mon, 5 Dec 2022 22:49:04 +0000 Subject: [PATCH] Remove APIs deprecated in 0.9 (#6801) # Objective These functions were deprecated in 0.9. They should be removed in 0.10. ## Solution Remove them. --- crates/bevy_ecs/src/archetype.rs | 2 +- crates/bevy_ecs/src/lib.rs | 2 +- crates/bevy_ecs/src/system/commands/mod.rs | 31 +--------------------- crates/bevy_ecs/src/world/entity_ref.rs | 24 ----------------- crates/bevy_hierarchy/src/child_builder.rs | 20 +------------- 5 files changed, 4 insertions(+), 75 deletions(-) diff --git a/crates/bevy_ecs/src/archetype.rs b/crates/bevy_ecs/src/archetype.rs index 8266ac0bf4..2cb0b47eef 100644 --- a/crates/bevy_ecs/src/archetype.rs +++ b/crates/bevy_ecs/src/archetype.rs @@ -99,7 +99,7 @@ pub(crate) struct SpawnBundleStatus; impl BundleComponentStatus for SpawnBundleStatus { #[inline] unsafe fn get_status(&self, _index: usize) -> ComponentStatus { - // Components added during a spawn_bundle call are always treated as added + // Components added during a spawn call are always treated as added ComponentStatus::Added } } diff --git a/crates/bevy_ecs/src/lib.rs b/crates/bevy_ecs/src/lib.rs index c88313fafb..eb53d91b6f 100644 --- a/crates/bevy_ecs/src/lib.rs +++ b/crates/bevy_ecs/src/lib.rs @@ -1129,7 +1129,7 @@ mod tests { } #[test] - fn remove_bundle() { + fn remove() { let mut world = World::default(); world.spawn((A(1), B(1), TableStored("1"))); let e2 = world.spawn((A(2), B(2), TableStored("2"))).id(); diff --git a/crates/bevy_ecs/src/system/commands/mod.rs b/crates/bevy_ecs/src/system/commands/mod.rs index 48e8b6097d..e89d365948 100644 --- a/crates/bevy_ecs/src/system/commands/mod.rs +++ b/crates/bevy_ecs/src/system/commands/mod.rs @@ -243,16 +243,6 @@ impl<'w, 's> Commands<'w, 's> { e } - #[deprecated( - since = "0.9.0", - note = "Use `spawn` instead, which now accepts bundles, components, and tuples of bundles and components." - )] - pub fn spawn_bundle<'a, T: Bundle>(&'a mut self, bundle: T) -> EntityCommands<'w, 's, 'a> { - let mut e = self.spawn_empty(); - e.insert(bundle); - e - } - /// Returns the [`EntityCommands`] for the requested [`Entity`]. /// /// # Panics @@ -397,7 +387,7 @@ impl<'w, 's> Commands<'w, 's> { /// /// This method is equivalent to iterating `bundles_iter`, /// calling [`get_or_spawn`](Self::get_or_spawn) for each bundle, - /// and passing it to [`insert_bundle`](EntityCommands::insert_bundle), + /// and passing it to [`insert`](EntityCommands::insert), /// but it is faster due to memory pre-allocation. /// /// # Note @@ -620,14 +610,6 @@ impl<'w, 's, 'a> EntityCommands<'w, 's, 'a> { self } - #[deprecated( - since = "0.9.0", - note = "Use `insert` instead, which now accepts bundles, components, and tuples of bundles and components." - )] - pub fn insert_bundle(&mut self, bundle: impl Bundle) -> &mut Self { - self.insert(bundle) - } - /// Removes a [`Bundle`] of components from the entity. /// /// See [`EntityMut::remove`](crate::world::EntityMut::remove) for more @@ -677,17 +659,6 @@ impl<'w, 's, 'a> EntityCommands<'w, 's, 'a> { self } - #[deprecated( - since = "0.9.0", - note = "Use `remove` instead, which now accepts bundles, components, and tuples of bundles and components." - )] - pub fn remove_bundle(&mut self) -> &mut Self - where - T: Bundle, - { - self.remove::() - } - /// Despawns the entity. /// /// See [`World::despawn`] for more details. diff --git a/crates/bevy_ecs/src/world/entity_ref.rs b/crates/bevy_ecs/src/world/entity_ref.rs index a723ea88b2..f0da529196 100644 --- a/crates/bevy_ecs/src/world/entity_ref.rs +++ b/crates/bevy_ecs/src/world/entity_ref.rs @@ -261,14 +261,6 @@ impl<'w> EntityMut<'w> { }) } - #[deprecated( - since = "0.9.0", - note = "Use `insert` instead, which now accepts bundles, components, and tuples of bundles and components." - )] - pub fn insert_bundle(&mut self, bundle: T) -> &mut Self { - self.insert(bundle) - } - /// Adds a [`Bundle`] of components to the entity. /// /// This will overwrite any previous value(s) of the same component type. @@ -294,14 +286,6 @@ impl<'w> EntityMut<'w> { self } - #[deprecated( - since = "0.9.0", - note = "Use `remove` instead, which now accepts bundles, components, and tuples of bundles and components." - )] - pub fn remove_bundle(&mut self) -> Option { - self.remove::() - } - // TODO: move to BundleInfo /// Removes a [`Bundle`] of components from the entity and returns the bundle. /// @@ -430,14 +414,6 @@ impl<'w> EntityMut<'w> { entities.set(entity.index(), new_location); } - #[deprecated( - since = "0.9.0", - note = "Use `remove_intersection` instead, which now accepts bundles, components, and tuples of bundles and components." - )] - pub fn remove_bundle_intersection(&mut self) { - self.remove_intersection::(); - } - // TODO: move to BundleInfo /// Remove any components in the bundle that the entity has. pub fn remove_intersection(&mut self) { diff --git a/crates/bevy_hierarchy/src/child_builder.rs b/crates/bevy_hierarchy/src/child_builder.rs index f73e8ebd35..fb092cee0b 100644 --- a/crates/bevy_hierarchy/src/child_builder.rs +++ b/crates/bevy_hierarchy/src/child_builder.rs @@ -219,15 +219,6 @@ pub struct ChildBuilder<'w, 's, 'a> { } impl<'w, 's, 'a> ChildBuilder<'w, 's, 'a> { - /// Spawns an entity with the given bundle and inserts it into the children defined by the [`ChildBuilder`] - #[deprecated( - since = "0.9.0", - note = "Use `spawn` instead, which now accepts bundles, components, and tuples of bundles and components." - )] - pub fn spawn_bundle(&mut self, bundle: impl Bundle) -> EntityCommands<'w, 's, '_> { - self.spawn(bundle) - } - /// Spawns an entity with the given bundle and inserts it into the children defined by the [`ChildBuilder`] pub fn spawn(&mut self, bundle: impl Bundle) -> EntityCommands<'w, 's, '_> { let e = self.commands.spawn(bundle); @@ -286,7 +277,7 @@ pub trait BuildChildren { /// /// parent_commands.insert(SomethingElse); /// commands.entity(child_id).with_children(|parent| { - /// parent.spawn_bundle(MoreStuff); + /// parent.spawn(MoreStuff); /// }); /// # } /// ``` @@ -411,15 +402,6 @@ impl<'w> WorldChildBuilder<'w> { self.world.entity_mut(entity) } - #[deprecated( - since = "0.9.0", - note = "Use `spawn` instead, which now accepts bundles, components, and tuples of bundles and components." - )] - /// Spawns an entity with the given bundle and inserts it into the children defined by the [`WorldChildBuilder`] - pub fn spawn_bundle(&mut self, bundle: impl Bundle + Send + Sync + 'static) -> EntityMut<'_> { - self.spawn(bundle) - } - /// Spawns an [`Entity`] with no components and inserts it into the children defined by the [`WorldChildBuilder`] which adds the [`Parent`] component to it. pub fn spawn_empty(&mut self) -> EntityMut<'_> { let entity = self.world.spawn(Parent(self.parent)).id();