Skip to content

Commit

Permalink
Reverted Noisy Change
Browse files Browse the repository at this point in the history
  • Loading branch information
ZacHarroldC5 committed Sep 5, 2023
1 parent 4e16b0b commit 492f209
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions crates/bevy_ecs/src/system/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -734,13 +734,16 @@ impl<'w, 's, Q: WorldQuery, F: ReadOnlyWorldQuery> Query<'w, 's, Q, F> {
/// - [`iter`](Self::iter) for the iterator based alternative.
#[inline]
pub fn for_each<'this>(&'this self, f: impl FnMut(ROQueryItem<'this, Q>)) {
let state = self.state.as_readonly();

// SAFETY:
// - `self.world` has permission to access the required components.
// - The query is read-only, so it can be aliased even if it was originally mutable.
unsafe {
state.for_each_unchecked_manual(self.world, f, self.last_run, self.this_run);
self.state.as_readonly().for_each_unchecked_manual(
self.world,
f,
self.last_run,
self.this_run,
);
};
}

Expand Down

0 comments on commit 492f209

Please sign in to comment.