From b0e2c98ded62dd506de0fdac2fef360bc16c294b Mon Sep 17 00:00:00 2001 From: Josh Simmons Date: Mon, 13 May 2024 23:27:20 +0200 Subject: [PATCH] narcissus-core: Use derive for flags impls --- engine/narcissus-core/src/lib.rs | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/engine/narcissus-core/src/lib.rs b/engine/narcissus-core/src/lib.rs index 3372d6c..1bd371d 100644 --- a/engine/narcissus-core/src/lib.rs +++ b/engine/narcissus-core/src/lib.rs @@ -121,7 +121,8 @@ macro_rules! flags_def { flags_def!($name, u32); }; ($name:ident, $ty:ty) => { - #[derive(PartialEq, Hash, Debug)] + #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Default)] + #[repr(transparent)] pub struct $name($ty); impl $name { @@ -151,22 +152,6 @@ macro_rules! flags_def { } } - impl Clone for $name { - fn clone(&self) -> Self { - *self - } - } - - impl Copy for $name {} - - impl Default for $name { - fn default() -> Self { - Self(0) - } - } - - impl Eq for $name {} - impl std::ops::BitOr for $name { type Output = Self; fn bitor(self, rhs: Self) -> Self::Output { -- 2.49.0