Skip to content
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 crates/bevy_app/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1582,7 +1582,7 @@ mod tests {
app.add_systems(EnterMainMenu, (foo, bar));

app.world_mut().run_schedule(EnterMainMenu);
assert_eq!(app.world().num_entities(), 2);
assert_eq!(app.world().entity_count(), 2);
}

#[test]
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_ecs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1637,7 +1637,7 @@ mod tests {

assert_eq!(q1.iter(&world).len(), 1);
assert_eq!(q2.iter(&world).len(), 1);
assert_eq!(world.num_entities(), 2);
assert_eq!(world.entity_count(), 2);

world.clear_entities();

Expand All @@ -1652,7 +1652,7 @@ mod tests {
"world should not contain sparse set components"
);
assert_eq!(
world.num_entities(),
world.entity_count(),
0,
"world should not have any entities"
);
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_ecs/src/observer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ mod tests {
world.spawn(A).flush();
assert_eq!(vec!["add_2", "add_1"], world.resource::<Order>().0);
// Our A entity plus our two observers
assert_eq!(world.num_entities(), 3);
assert_eq!(world.entity_count(), 3);
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_ecs/src/system/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2342,7 +2342,7 @@ mod tests {
.spawn((W(1u32), W(2u64)))
.id();
command_queue.apply(&mut world);
assert_eq!(world.num_entities(), 1);
assert_eq!(world.entity_count(), 1);
let results = world
.query::<(&W<u32>, &W<u64>)>()
.iter(&world)
Expand Down
6 changes: 3 additions & 3 deletions crates/bevy_ecs/src/world/command_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,12 +423,12 @@ mod test {
let mut world = World::new();
queue.apply(&mut world);

assert_eq!(world.num_entities(), 2);
assert_eq!(world.entity_count(), 2);

// The previous call to `apply` cleared the queue.
// This call should do nothing.
queue.apply(&mut world);
assert_eq!(world.num_entities(), 2);
assert_eq!(world.entity_count(), 2);
}

#[expect(
Expand Down Expand Up @@ -462,7 +462,7 @@ mod test {
queue.push(SpawnCommand);
queue.push(SpawnCommand);
queue.apply(&mut world);
assert_eq!(world.num_entities(), 3);
assert_eq!(world.entity_count(), 3);
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_ecs/src/world/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ impl World {
///
/// This is helpful as a diagnostic, but it can also be used effectively in tests.
#[inline]
pub fn num_entities(&self) -> u32 {
pub fn entity_count(&self) -> u32 {
self.entities.len()
}

Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_pbr/src/cluster/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -535,12 +535,12 @@ pub fn extract_clusters(
continue;
}

let num_entities: usize = clusters
let entity_count: usize = clusters
.clusterable_objects
.iter()
.map(|l| l.entities.len())
.sum();
let mut data = Vec::with_capacity(clusters.clusterable_objects.len() + num_entities);
let mut data = Vec::with_capacity(clusters.clusterable_objects.len() + entity_count);
for cluster_objects in &clusters.clusterable_objects {
data.push(ExtractedClusterableObjectElement::ClusterHeader(
cluster_objects.counts,
Expand Down