From 0e4643c2b95d141916174f215ad07de06fa6e698 Mon Sep 17 00:00:00 2001 From: Urben1680 Date: Tue, 15 Jul 2025 21:36:41 +0200 Subject: [PATCH] ci --- crates/bevy_ecs/src/bundle/info.rs | 20 ++------------------ crates/bevy_ecs/src/lib.rs | 28 +--------------------------- 2 files changed, 3 insertions(+), 45 deletions(-) diff --git a/crates/bevy_ecs/src/bundle/info.rs b/crates/bevy_ecs/src/bundle/info.rs index 8cf9131a93..56f18313f0 100644 --- a/crates/bevy_ecs/src/bundle/info.rs +++ b/crates/bevy_ecs/src/bundle/info.rs @@ -166,8 +166,7 @@ impl BundleInfo { match component_to_containing_bundles.get_mut(component.index()) { Some(bundles) => bundles.push(self.id), None => { - component_to_containing_bundles - .resize_with(component.index() + 1, || Vec::new()); + component_to_containing_bundles.resize_with(component.index() + 1, Vec::new); *component_to_containing_bundles.last_mut().unwrap() = vec![self.id]; } } @@ -468,21 +467,6 @@ impl Bundles { self.bundle_infos.iter() } - /// Iterate over [`BundleInfo`] containing `component`, either explicitly or as required. - pub(crate) fn iter_containing( - &self, - component: ComponentId, - ) -> impl Iterator { - self.component_to_containing_bundles - .get(component.index()) - .into_iter() - .flatten() - .map(|id| { - // SAFETY: component_to_containing_bundles contains only valid ids - unsafe { self.bundle_infos.get(id.index()).debug_checked_unwrap() } - }) - } - /// Gets the metadata associated with a specific type of bundle. /// Returns `None` if the bundle is not registered with the world. #[inline] @@ -535,7 +519,7 @@ impl Bundles { if let Some(id) = self.contributed_bundle_ids.get(&TypeId::of::()).cloned() { id } else { - let explicit_bundle_id = self.register_info::(components, storages); + let explicit_bundle_id: BundleId = self.register_info::(components, storages); // SAFETY: reading from `explicit_bundle_id` and creating new bundle in same time. Its valid because bundle hashmap allow this let id = unsafe { let (ptr, len) = { diff --git a/crates/bevy_ecs/src/lib.rs b/crates/bevy_ecs/src/lib.rs index 1f7470e6f3..9890de837d 100644 --- a/crates/bevy_ecs/src/lib.rs +++ b/crates/bevy_ecs/src/lib.rs @@ -146,7 +146,7 @@ pub struct HotPatched; #[cfg(test)] mod tests { use crate::{ - bundle::{Bundle, BundleId, BundleInfo}, + bundle::Bundle, change_detection::Ref, component::{Component, ComponentId, RequiredComponents, RequiredComponentsError}, entity::{Entity, EntityMapper}, @@ -2595,14 +2595,6 @@ mod tests { #[derive(Component, Default)] struct E; - fn bundle_containing(world: &World, component: ComponentId) -> Option { - world - .bundles() - .iter_containing(component) - .next() - .map(BundleInfo::id) - } - let mut world = World::new(); let a_id = world.register_component::(); @@ -2621,12 +2613,6 @@ mod tests { assert!(!contributed.contains(&d_id)); assert!(!contributed.contains(&e_id)); - assert_eq!(bundle_containing(&world, a_id), Some(bundle_id)); - assert_eq!(bundle_containing(&world, b_id), Some(bundle_id)); - assert_eq!(bundle_containing(&world, c_id), None); - assert_eq!(bundle_containing(&world, d_id), None); - assert_eq!(bundle_containing(&world, e_id), None); - // check if registration succeeds world.register_required_components::(); let bundle = world.bundles().get(bundle_id).unwrap(); @@ -2638,12 +2624,6 @@ mod tests { assert!(contributed.contains(&d_id)); assert!(!contributed.contains(&e_id)); - assert_eq!(bundle_containing(&world, a_id), Some(bundle_id)); - assert_eq!(bundle_containing(&world, b_id), Some(bundle_id)); - assert_eq!(bundle_containing(&world, c_id), Some(bundle_id)); - assert_eq!(bundle_containing(&world, d_id), Some(bundle_id)); - assert_eq!(bundle_containing(&world, e_id), None); - // check if another registration can be associated to the bundle using the previously registered component world.register_required_components::(); let bundle = world.bundles().get(bundle_id).unwrap(); @@ -2654,12 +2634,6 @@ mod tests { assert!(contributed.contains(&c_id)); assert!(contributed.contains(&d_id)); assert!(contributed.contains(&e_id)); - - assert_eq!(bundle_containing(&world, a_id), Some(bundle_id)); - assert_eq!(bundle_containing(&world, b_id), Some(bundle_id)); - assert_eq!(bundle_containing(&world, c_id), Some(bundle_id)); - assert_eq!(bundle_containing(&world, d_id), Some(bundle_id)); - assert_eq!(bundle_containing(&world, e_id), Some(bundle_id)); } #[test]