From 7d928c3a8b82954e5f61e0d6b4ab83f2767da9c8 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 31 Oct 2022 15:34:00 +0100 Subject: [PATCH] derive Copy instead of implementing it by hand --- src/macros.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/macros.rs b/src/macros.rs index 0bbd6aabf..f065ffd37 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -252,19 +252,17 @@ macro_rules! FLAGS { } macro_rules! STRUCT { {$(#[$attrs:meta])* nodebug struct $name:ident { $($field:ident: $ftype:ty,)+ }} => { - #[repr(C)] $(#[$attrs])* + #[repr(C)] #[derive(Copy)] $(#[$attrs])* pub struct $name { $(pub $field: $ftype,)+ } - impl Copy for $name {} impl Clone for $name { fn clone(&self) -> $name { *self } } }; {$(#[$attrs:meta])* struct $name:ident { $($field:ident: $ftype:ty,)+ }} => { - #[repr(C)] #[derive(Debug)] $(#[$attrs])* + #[repr(C)] #[derive(Debug, Copy)] $(#[$attrs])* pub struct $name { $(pub $field: $ftype,)+ } - impl Copy for $name {} impl Clone for $name { fn clone(&self) -> $name { *self } } }; }