Skip to content

Commit 538c20a

Browse files
committed
Satisfy clippy
1 parent 146cacf commit 538c20a

File tree

1 file changed

+11
-3
lines changed
  • crates/bevy_ecs/src/entity

1 file changed

+11
-3
lines changed

crates/bevy_ecs/src/entity/mod.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub use map_entities::*;
3030

3131
use crate::{archetype::ArchetypeId, storage::SparseSetIndex};
3232
use std::{
33-
cmp::Ordering as CmpOrdering,
33+
cmp::{Ordering as CmpOrdering, PartialEq},
3434
convert::TryFrom,
3535
fmt,
3636
hash::{Hash, Hasher},
@@ -48,7 +48,7 @@ use std::{
4848
/// Components of a specific entity can be accessed using
4949
/// [`Query::get`](crate::system::Query::get) and related methods.
5050
#[cfg(target_endian = "little")]
51-
#[derive(Clone, Copy, Eq, PartialEq)]
51+
#[derive(Clone, Copy)]
5252
#[repr(C, align(8))]
5353
pub struct Entity {
5454
// Do not reorder the fields here. The ordering is explicitly used by repr(C)
@@ -67,7 +67,7 @@ pub struct Entity {
6767
/// Components of a specific entity can be accessed using
6868
/// [`Query::get`](crate::system::Query::get) and related methods.
6969
#[cfg(target_endian = "big")]
70-
#[derive(Clone, Copy, Eq, PartialEq)]
70+
#[derive(Clone, Copy)]
7171
#[repr(C, align(8))]
7272
pub struct Entity {
7373
// Do not reorder the fields here. The ordering is explicitly used by repr(C)
@@ -193,6 +193,14 @@ impl Hash for Entity {
193193
}
194194
}
195195

196+
impl PartialEq for Entity {
197+
fn eq(&self, other: &Self) -> bool {
198+
self.to_bits() == other.to_bits()
199+
}
200+
}
201+
202+
impl Eq for Entity {}
203+
196204
impl fmt::Debug for Entity {
197205
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
198206
write!(f, "{}v{}", self.id, self.generation)

0 commit comments

Comments
 (0)