Skip to content

Commit a039b5f

Browse files
Apply suggestions from code review
Co-authored-by: Chris Russell <8494645+chescock@users.noreply.github.com>
1 parent a2d8cd2 commit a039b5f

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

crates/bevy_ecs/src/query/state.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ impl<D: QueryData, F: QueryFilter> QueryState<D, F> {
171171
///
172172
/// This function may fail if, for example,
173173
/// the components that make up this query have not been registered into the world.
174-
#[deprecated(since = "0.19.0", note = "Use `init_state` instead.")]
174+
#[deprecated(since = "0.19.0", note = "Use `new` instead.")]
175175
pub fn try_new(world: &World) -> Option<Self> {
176176
let mut state = Self::try_new_uninitialized(world)?;
177177
state.update_archetypes(world);

crates/bevy_ecs/src/world/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1746,7 +1746,7 @@ impl World {
17461746
/// assert!(some_query.is_some());
17471747
/// ```
17481748
#[inline]
1749-
#[deprecated(since = "0.19.0", note = "Use `init_state` instead.")]
1749+
#[deprecated(since = "0.19.0", note = "Use `query` instead.")]
17501750
#[expect(deprecated, reason = "also deprecated")]
17511751
pub fn try_query<D: QueryData>(&self) -> Option<QueryState<D, ()>> {
17521752
self.try_query_filtered::<D, ()>()
@@ -1775,7 +1775,7 @@ impl World {
17751775
/// Requires only an immutable world reference, but may fail if, for example,
17761776
/// the components that make up this query have not been registered into the world.
17771777
#[inline]
1778-
#[deprecated(since = "0.19.0", note = "Use `init_state` instead.")]
1778+
#[deprecated(since = "0.19.0", note = "Use `query_filtered` instead.")]
17791779
#[expect(deprecated, reason = "also deprecated")]
17801780
pub fn try_query_filtered<D: QueryData, F: QueryFilter>(&self) -> Option<QueryState<D, F>> {
17811781
QueryState::try_new(self)

release-content/release-notes/readonly_query_states.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ fn read_sub_world(sub_world: Res<MySubWorld>) {
2929

3030
```
3131

32-
Note that using `World::query` or `QueryState::new` each time results in an uncached query.
32+
Note that using `World::query` or `QueryState::new` initializes a new query cache each time.
3333
The query state and matching tables must be recalculated each time.
3434
As a result, for queries that are running very frequently, caching the `QueryState` (through system parameters, for example) is still a good idea.

0 commit comments

Comments
 (0)