Skip to content

Commit 0004d01

Browse files
committed
yeet
1 parent c1a2378 commit 0004d01

File tree

4 files changed

+26
-22
lines changed

4 files changed

+26
-22
lines changed

crates/bevy_ecs/src/system/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -804,13 +804,13 @@ mod tests {
804804
}
805805
fn hold_component<'w>(&mut self, world: &'w World, entity: Entity) -> Holder<'w> {
806806
let q = self.state_q.get(world);
807-
let a = q.get(entity).unwrap();
807+
let a = unsafe { q.get_unchecked(entity) }.unwrap();
808808
Holder { value: a }
809809
}
810810
fn hold_components<'w>(&mut self, world: &'w World) -> Vec<Holder<'w>> {
811811
let mut components = Vec::new();
812812
let q = self.state_q.get(world);
813-
for a in q.iter() {
813+
for a in unsafe { q.iter_unsafe() } {
814814
components.push(Holder { value: a });
815815
}
816816
components

crates/bevy_ecs/src/system/query.rs

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ where
299299
/// # bevy_ecs::system::assert_is_system(report_names_system);
300300
/// ```
301301
#[inline]
302-
pub fn iter(&'s self) -> QueryIter<'w, 's, Q, Q::ReadOnlyFetch, F> {
302+
pub fn iter(&self) -> QueryIter<'_, 's, Q, Q::ReadOnlyFetch, F> {
303303
// SAFE: system runs without conflicts with other systems.
304304
// same-system queries have runtime borrow checks when they conflict
305305
unsafe {
@@ -454,17 +454,19 @@ where
454454
/// # bevy_ecs::system::assert_is_system(report_names_system);
455455
/// ```
456456
#[inline]
457-
pub fn for_each<FN: FnMut(<Q::ReadOnlyFetch as Fetch<'w, 's>>::Item)>(&'s self, f: FN) {
457+
pub fn for_each<'this>(
458+
&'this self,
459+
f: impl FnMut(<Q::ReadOnlyFetch as Fetch<'this, 's>>::Item),
460+
) {
458461
// SAFE: system runs without conflicts with other systems.
459462
// same-system queries have runtime borrow checks when they conflict
460463
unsafe {
461-
self.state
462-
.for_each_unchecked_manual::<Q::ReadOnlyFetch, FN>(
463-
self.world,
464-
f,
465-
self.last_change_tick,
466-
self.change_tick,
467-
);
464+
self.state.for_each_unchecked_manual::<Q::ReadOnlyFetch, _>(
465+
self.world,
466+
f,
467+
self.last_change_tick,
468+
self.change_tick,
469+
);
468470
};
469471
}
470472

@@ -524,17 +526,17 @@ where
524526
///* `batch_size` - The number of batches to spawn
525527
///* `f` - The function to run on each item in the query
526528
#[inline]
527-
pub fn par_for_each<FN: Fn(<Q::ReadOnlyFetch as Fetch<'w, 's>>::Item) + Send + Sync + Clone>(
528-
&'s self,
529+
pub fn par_for_each<'this>(
530+
&'this self,
529531
task_pool: &TaskPool,
530532
batch_size: usize,
531-
f: FN,
533+
f: impl Fn(<Q::ReadOnlyFetch as Fetch<'this, 's>>::Item) + Send + Sync + Clone,
532534
) {
533535
// SAFE: system runs without conflicts with other systems. same-system queries have runtime
534536
// borrow checks when they conflict
535537
unsafe {
536538
self.state
537-
.par_for_each_unchecked_manual::<Q::ReadOnlyFetch, FN>(
539+
.par_for_each_unchecked_manual::<Q::ReadOnlyFetch, _>(
538540
self.world,
539541
task_pool,
540542
batch_size,
@@ -601,9 +603,9 @@ where
601603
/// ```
602604
#[inline]
603605
pub fn get(
604-
&'s self,
606+
&self,
605607
entity: Entity,
606-
) -> Result<<Q::ReadOnlyFetch as Fetch<'w, 's>>::Item, QueryEntityError> {
608+
) -> Result<<Q::ReadOnlyFetch as Fetch<'_, 's>>::Item, QueryEntityError> {
607609
// SAFE: system runs without conflicts with other systems.
608610
// same-system queries have runtime borrow checks when they conflict
609611
unsafe {
@@ -834,7 +836,7 @@ where
834836
/// Panics if the number of query results is not exactly one. Use
835837
/// [`get_single`](Self::get_single) to return a `Result` instead of panicking.
836838
#[track_caller]
837-
pub fn single(&'s self) -> <Q::ReadOnlyFetch as Fetch<'w, 's>>::Item {
839+
pub fn single(&self) -> <Q::ReadOnlyFetch as Fetch<'_, 's>>::Item {
838840
self.get_single().unwrap()
839841
}
840842

@@ -870,8 +872,8 @@ where
870872
/// # bevy_ecs::system::assert_is_system(player_scoring_system);
871873
/// ```
872874
pub fn get_single(
873-
&'s self,
874-
) -> Result<<Q::ReadOnlyFetch as Fetch<'w, 's>>::Item, QuerySingleError> {
875+
&self,
876+
) -> Result<<Q::ReadOnlyFetch as Fetch<'_, 's>>::Item, QuerySingleError> {
875877
let mut query = self.iter();
876878
let first = query.next();
877879
let extra = query.next().is_some();

crates/bevy_pbr/src/render/mesh.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,8 @@ impl<const I: usize> EntityRenderCommand for SetMeshViewBindGroup<I> {
625625
view_query: SystemParamItem<'w, '_, Self::Param>,
626626
pass: &mut TrackedRenderPass<'w>,
627627
) -> RenderCommandResult {
628-
let (view_uniform, view_lights, mesh_view_bind_group) = view_query.get(view).unwrap();
628+
let (view_uniform, view_lights, mesh_view_bind_group) =
629+
unsafe { view_query.get_unchecked(view) }.unwrap();
629630
pass.set_bind_group(
630631
I,
631632
&mesh_view_bind_group.value,

crates/bevy_sprite/src/mesh2d/mesh.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,8 @@ impl<const I: usize> EntityRenderCommand for SetMesh2dViewBindGroup<I> {
401401
view_query: SystemParamItem<'w, '_, Self::Param>,
402402
pass: &mut TrackedRenderPass<'w>,
403403
) -> RenderCommandResult {
404-
let (view_uniform, mesh2d_view_bind_group) = view_query.get(view).unwrap();
404+
let (view_uniform, mesh2d_view_bind_group) =
405+
unsafe { view_query.get_unchecked(view) }.unwrap();
405406
pass.set_bind_group(I, &mesh2d_view_bind_group.value, &[view_uniform.offset]);
406407

407408
RenderCommandResult::Success

0 commit comments

Comments
 (0)