Fix clippy::let_and_return in bevy_ecs (#18481)

# Objective

- `clippy::let_and_return` fails in `bevy_ecs`

## Solution

- Fixed it!

## Testing

- CI
This commit is contained in:
Zachary Harrold 2025-03-22 22:48:40 +11:00 committed by François Mockers
parent 04a0a74157
commit cfcb55d778
2 changed files with 4 additions and 6 deletions

View File

@ -942,7 +942,7 @@ impl Archetypes {
let archetypes = &mut self.archetypes;
let archetype_component_count = &mut self.archetype_component_count;
let component_index = &mut self.by_component;
let archetype_id = *self
*self
.by_components
.entry(archetype_identity)
.or_insert_with_key(move |identity| {
@ -975,8 +975,7 @@ impl Archetypes {
.zip(sparse_set_archetype_components),
));
id
});
archetype_id
})
}
/// Returns the number of components that are stored in archetypes.

View File

@ -1585,7 +1585,7 @@ impl Bundles {
storages: &mut Storages,
) -> BundleId {
let bundle_infos = &mut self.bundle_infos;
let id = *self.bundle_ids.entry(TypeId::of::<T>()).or_insert_with(|| {
*self.bundle_ids.entry(TypeId::of::<T>()).or_insert_with(|| {
let mut component_ids= Vec::new();
T::component_ids(components, &mut |id| component_ids.push(id));
let id = BundleId(bundle_infos.len());
@ -1597,8 +1597,7 @@ impl Bundles {
unsafe { BundleInfo::new(core::any::type_name::<T>(), storages, components, component_ids, id) };
bundle_infos.push(bundle_info);
id
});
id
})
}
/// Registers a new [`BundleInfo`], which contains both explicit and required components for a statically known type.