Add #[track_caller] to Query methods (#12984)
				
					
				
			# Objective - Closes #12958 ## Solution - Find all methods under `Query` that mention panicking, and add `#[track_caller]` to them. --- ## Changelog - Added `#[track_caller]` to `Query::many`, `Query::many_mut`, `Query::transmute_lens`, and `Query::transmute_lens_filtered`. ## For reviewers I'm unfamiliar with the depths of the `Query` struct. Please check whether it makes since for the updated methods to have `#[track_caller]`, and if I missed any!
This commit is contained in:
		
							parent
							
								
									538d699994
								
							
						
					
					
						commit
						c8d214d505
					
				| @ -922,6 +922,7 @@ impl<'w, 's, D: QueryData, F: QueryFilter> Query<'w, 's, D, F> { | |||||||
|     ///
 |     ///
 | ||||||
|     /// - [`get_many`](Self::get_many) for the non-panicking version.
 |     /// - [`get_many`](Self::get_many) for the non-panicking version.
 | ||||||
|     #[inline] |     #[inline] | ||||||
|  |     #[track_caller] | ||||||
|     pub fn many<const N: usize>(&self, entities: [Entity; N]) -> [ROQueryItem<'_, D>; N] { |     pub fn many<const N: usize>(&self, entities: [Entity; N]) -> [ROQueryItem<'_, D>; N] { | ||||||
|         match self.get_many(entities) { |         match self.get_many(entities) { | ||||||
|             Ok(items) => items, |             Ok(items) => items, | ||||||
| @ -1038,6 +1039,7 @@ impl<'w, 's, D: QueryData, F: QueryFilter> Query<'w, 's, D, F> { | |||||||
|     /// - [`get_many_mut`](Self::get_many_mut) for the non panicking version.
 |     /// - [`get_many_mut`](Self::get_many_mut) for the non panicking version.
 | ||||||
|     /// - [`many`](Self::many) to get read-only query items.
 |     /// - [`many`](Self::many) to get read-only query items.
 | ||||||
|     #[inline] |     #[inline] | ||||||
|  |     #[track_caller] | ||||||
|     pub fn many_mut<const N: usize>(&mut self, entities: [Entity; N]) -> [D::Item<'_>; N] { |     pub fn many_mut<const N: usize>(&mut self, entities: [Entity; N]) -> [D::Item<'_>; N] { | ||||||
|         match self.get_many_mut(entities) { |         match self.get_many_mut(entities) { | ||||||
|             Ok(items) => items, |             Ok(items) => items, | ||||||
| @ -1351,6 +1353,7 @@ impl<'w, 's, D: QueryData, F: QueryFilter> Query<'w, 's, D, F> { | |||||||
|     ///  
 |     ///  
 | ||||||
|     /// [`EntityLocation`]: crate::entity::EntityLocation
 |     /// [`EntityLocation`]: crate::entity::EntityLocation
 | ||||||
|     /// [`&Archetype`]: crate::archetype::Archetype
 |     /// [`&Archetype`]: crate::archetype::Archetype
 | ||||||
|  |     #[track_caller] | ||||||
|     pub fn transmute_lens<NewD: QueryData>(&mut self) -> QueryLens<'_, NewD> { |     pub fn transmute_lens<NewD: QueryData>(&mut self) -> QueryLens<'_, NewD> { | ||||||
|         self.transmute_lens_filtered::<NewD, ()>() |         self.transmute_lens_filtered::<NewD, ()>() | ||||||
|     } |     } | ||||||
| @ -1361,6 +1364,7 @@ impl<'w, 's, D: QueryData, F: QueryFilter> Query<'w, 's, D, F> { | |||||||
|     /// additional archetypal query terms like [`With`](crate::query::With) and [`Without`](crate::query::Without)
 |     /// additional archetypal query terms like [`With`](crate::query::With) and [`Without`](crate::query::Without)
 | ||||||
|     /// will not necessarily be respected and non-archetypal terms like [`Added`](crate::query::Added) and
 |     /// will not necessarily be respected and non-archetypal terms like [`Added`](crate::query::Added) and
 | ||||||
|     /// [`Changed`](crate::query::Changed) will only be respected if they are in the type signature.
 |     /// [`Changed`](crate::query::Changed) will only be respected if they are in the type signature.
 | ||||||
|  |     #[track_caller] | ||||||
|     pub fn transmute_lens_filtered<NewD: QueryData, NewF: QueryFilter>( |     pub fn transmute_lens_filtered<NewD: QueryData, NewF: QueryFilter>( | ||||||
|         &mut self, |         &mut self, | ||||||
|     ) -> QueryLens<'_, NewD, NewF> { |     ) -> QueryLens<'_, NewD, NewF> { | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 BD103
						BD103