From d6052f7cd6e5b64759005a74d4bfca0c04ef0667 Mon Sep 17 00:00:00 2001 From: harudagondi Date: Thu, 13 Jan 2022 21:14:32 +0800 Subject: [PATCH] Adjust trait impls based on code review --- crates/bevy_ecs/src/query/filter.rs | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/crates/bevy_ecs/src/query/filter.rs b/crates/bevy_ecs/src/query/filter.rs index e8cd229fc6d60..b806b4349c55a 100644 --- a/crates/bevy_ecs/src/query/filter.rs +++ b/crates/bevy_ecs/src/query/filter.rs @@ -76,7 +76,6 @@ impl WorldQuery for With { } /// The [`Fetch`] of [`With`]. -#[derive(Copy)] pub struct WithFetch { marker: PhantomData, } @@ -175,6 +174,8 @@ impl Clone for WithFetch { } } +impl Copy for WithFetch {} + /// Filter that selects entities without a component `T`. /// /// This is the negation of [`With`]. @@ -208,7 +209,6 @@ impl WorldQuery for Without { } /// The [`Fetch`] of [`Without`]. -#[derive(Copy)] pub struct WithoutFetch { marker: PhantomData, } @@ -307,6 +307,8 @@ impl Clone for WithoutFetch { } } +impl Copy for WithoutFetch {} + /// A filter that tests if any of the given filters apply. /// /// This is useful for example if a system with multiple components in a query only wants to run @@ -341,21 +343,12 @@ impl Clone for WithoutFetch { pub struct Or(pub T); /// The [`Fetch`] of [`Or`]. -#[derive(Copy)] +#[derive(Clone, Copy)] pub struct OrFetch { fetch: T, matches: bool, } -impl Clone for OrFetch { - fn clone(&self) -> Self { - Self { - fetch: self.fetch.clone(), - matches: self.matches, - } - } -} - macro_rules! impl_query_filter_tuple { ($(($filter: ident, $state: ident)),*) => { #[allow(unused_variables)] @@ -485,7 +478,6 @@ macro_rules! impl_tick_filter { pub struct $name(PhantomData); $(#[$fetch_meta])* - #[derive(Copy)] pub struct $fetch_name { table_ticks: *const UnsafeCell, entity_table_rows: *const usize, @@ -630,6 +622,8 @@ macro_rules! impl_tick_filter { } } } + + impl Copy for $fetch_name {} }; }