@@ -79,7 +79,7 @@ use std::{cell::UnsafeCell, marker::PhantomData};
79
79
/// }
80
80
///
81
81
/// fn my_system(query: Query<MyQuery>) {
82
- /// for q in query.iter() {
82
+ /// for q in & query {
83
83
/// // Note the type of the returned item.
84
84
/// let q: MyQueryItem<'_> = q;
85
85
/// q.foo;
@@ -130,11 +130,11 @@ use std::{cell::UnsafeCell, marker::PhantomData};
130
130
///
131
131
/// fn my_system(mut health_query: Query<HealthQuery>) {
132
132
/// // Iterator's item is `HealthQueryReadOnlyItem`.
133
- /// for health in health_query.iter() {
133
+ /// for health in & health_query {
134
134
/// println!("Total: {}", health.total());
135
135
/// }
136
136
/// // Iterator's item is `HealthQueryItem`.
137
- /// for mut health in health_query.iter_mut() {
137
+ /// for mut health in &mut health_query {
138
138
/// health.damage(1.0);
139
139
/// println!("Total (mut): {}", health.total());
140
140
/// }
@@ -158,7 +158,7 @@ use std::{cell::UnsafeCell, marker::PhantomData};
158
158
/// }
159
159
///
160
160
/// fn my_system(mut my_query: Query<(FooReadOnly, FooReadOnly)>) {
161
- /// for (i1, i2) in my_query.iter_mut() {
161
+ /// for (i1, i2) in &mut my_query {
162
162
/// let _: FooReadOnlyItem<'_> = i1;
163
163
/// let _: FooReadOnlyItem<'_> = i2;
164
164
/// }
@@ -254,7 +254,7 @@ use std::{cell::UnsafeCell, marker::PhantomData};
254
254
///
255
255
/// // You can also compose derived queries with regular ones in tuples.
256
256
/// fn my_system(query: Query<(&Foo, MyQuery, FooQuery)>) {
257
- /// for (foo, my_query, foo_query) in query.iter() {
257
+ /// for (foo, my_query, foo_query) in & query {
258
258
/// foo; my_query; foo_query;
259
259
/// }
260
260
/// }
@@ -279,7 +279,7 @@ use std::{cell::UnsafeCell, marker::PhantomData};
279
279
/// }
280
280
///
281
281
/// fn my_system(query: Query<EmptyQuery>) {
282
- /// for _ in query.iter() {}
282
+ /// for _ in & query {}
283
283
/// }
284
284
///
285
285
/// # bevy_ecs::system::assert_is_system(my_system);
@@ -311,7 +311,7 @@ use std::{cell::UnsafeCell, marker::PhantomData};
311
311
/// }
312
312
///
313
313
/// fn my_system(query: Query<Entity, MyFilter<Foo, Qux>>) {
314
- /// for _ in query.iter() {}
314
+ /// for _ in & query {}
315
315
/// }
316
316
///
317
317
/// # bevy_ecs::system::assert_is_system(my_system);
@@ -1087,7 +1087,7 @@ unsafe impl<'w, T: Fetch<'w>> Fetch<'w> for OptionFetch<T> {
1087
1087
/// # struct Transform {};
1088
1088
/// #
1089
1089
/// fn print_moving_objects_system(query: Query<(&Name, ChangeTrackers<Transform>)>) {
1090
- /// for (name, tracker) in query.iter() {
1090
+ /// for (name, tracker) in & query {
1091
1091
/// if tracker.is_changed() {
1092
1092
/// println!("Entity moved: {:?}", name);
1093
1093
/// } else {
0 commit comments