Skip to content

Commit

Permalink
Adjust trait impls based on code review
Browse files Browse the repository at this point in the history
  • Loading branch information
harudagondi committed Jan 13, 2022
1 parent 381d8a7 commit d6052f7
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions crates/bevy_ecs/src/query/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ impl<T: Component> WorldQuery for With<T> {
}

/// The [`Fetch`] of [`With`].
#[derive(Copy)]
pub struct WithFetch<T> {
marker: PhantomData<T>,
}
Expand Down Expand Up @@ -175,6 +174,8 @@ impl<T> Clone for WithFetch<T> {
}
}

impl<T> Copy for WithFetch<T> {}

/// Filter that selects entities without a component `T`.
///
/// This is the negation of [`With`].
Expand Down Expand Up @@ -208,7 +209,6 @@ impl<T: Component> WorldQuery for Without<T> {
}

/// The [`Fetch`] of [`Without`].
#[derive(Copy)]
pub struct WithoutFetch<T> {
marker: PhantomData<T>,
}
Expand Down Expand Up @@ -307,6 +307,8 @@ impl<T> Clone for WithoutFetch<T> {
}
}

impl<T> Copy for WithoutFetch<T> {}

/// 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
Expand Down Expand Up @@ -341,21 +343,12 @@ impl<T> Clone for WithoutFetch<T> {
pub struct Or<T>(pub T);

/// The [`Fetch`] of [`Or`].
#[derive(Copy)]
#[derive(Clone, Copy)]
pub struct OrFetch<T: FilterFetch> {
fetch: T,
matches: bool,
}

impl<T: FilterFetch + Clone> Clone for OrFetch<T> {
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)]
Expand Down Expand Up @@ -485,7 +478,6 @@ macro_rules! impl_tick_filter {
pub struct $name<T>(PhantomData<T>);

$(#[$fetch_meta])*
#[derive(Copy)]
pub struct $fetch_name<T> {
table_ticks: *const UnsafeCell<ComponentTicks>,
entity_table_rows: *const usize,
Expand Down Expand Up @@ -630,6 +622,8 @@ macro_rules! impl_tick_filter {
}
}
}

impl<T> Copy for $fetch_name<T> {}
};
}

Expand Down

0 comments on commit d6052f7

Please sign in to comment.