extract common code from a if block (#8959)

Some code could be improved.

## Solution

Improve the code
This commit is contained in:
Nicola Papale 2023-06-26 17:17:56 +02:00 committed by GitHub
parent bec299fa6e
commit 4b1a502a49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -883,13 +883,11 @@ unsafe fn remove_bundle_from_archetype(
// check the archetype graph to see if the Bundle has been removed from this archetype in the // check the archetype graph to see if the Bundle has been removed from this archetype in the
// past // past
let remove_bundle_result = { let remove_bundle_result = {
let current_archetype = &mut archetypes[archetype_id]; let edges = archetypes[archetype_id].edges();
if intersection { if intersection {
current_archetype edges.get_remove_bundle(bundle_info.id())
.edges()
.get_remove_bundle(bundle_info.id())
} else { } else {
current_archetype.edges().get_take_bundle(bundle_info.id()) edges.get_take_bundle(bundle_info.id())
} }
}; };
let result = if let Some(result) = remove_bundle_result { let result = if let Some(result) = remove_bundle_result {