Skip to content

Commit

Permalink
replace unbounded loop with for
Browse files Browse the repository at this point in the history
  • Loading branch information
aevyrie committed Feb 17, 2025
1 parent 264ac88 commit d7c03ab
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions crates/bevy_transform/src/systems.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,11 +399,9 @@ mod parallel {
// Create local mutable copies of the input variables, used for the optimization below.
let (mut parent, mut p_global_transform, mut p_children) =
(parent, p_global_transform, p_children);
let mut depth = 0;

// See the optimization note at the end to understand why this loop is here.
loop {
depth += 1;
for depth in 1..=max_depth {
// Safety: traversing the entity tree from the roots, we assert that the childof and
// children pointers match in both directions (see assert below) to ensure the hierarchy
// does not have any cycles. Because the hierarchy does not have cycles, we know we are
Expand Down

0 comments on commit d7c03ab

Please sign in to comment.