From 1619d42e78181f9478883f1eda1c546a386c5e29 Mon Sep 17 00:00:00 2001 From: Testare Date: Thu, 28 Mar 2024 11:31:50 -0700 Subject: [PATCH] Add Debug to Has Query type (#12722) # Objective Pretty minor change to add `Debug` to `Has`. This is helpful for users (Like me) who have the [`missing_debug_implementations`](https://doc.rust-lang.org/stable/nightly-rustc/rustc_lint/builtin/static.MISSING_DEBUG_IMPLEMENTATIONS.html) lint turned on. ## Solution Simple `#[derive(Debug)]` ## Changelog * Has now implemented `Debug` --- crates/bevy_ecs/src/query/fetch.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/bevy_ecs/src/query/fetch.rs b/crates/bevy_ecs/src/query/fetch.rs index 7f249f4a36660..5c7d7b21f260d 100644 --- a/crates/bevy_ecs/src/query/fetch.rs +++ b/crates/bevy_ecs/src/query/fetch.rs @@ -1410,6 +1410,12 @@ unsafe impl ReadOnlyQueryData for Option {} /// ``` pub struct Has(PhantomData); +impl std::fmt::Debug for Has { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> { + write!(f, "Has<{}>", std::any::type_name::()) + } +} + /// SAFETY: /// `update_component_access` and `update_archetype_component_access` do nothing. /// This is sound because `fetch` does not access components.