diff --git a/src/key.rs b/src/key.rs index 9cbd44d28..e739c964e 100644 --- a/src/key.rs +++ b/src/key.rs @@ -56,7 +56,7 @@ use crate::{hashes, ThirtyTwoByteHash}; /// ``` /// [`bincode`]: https://docs.rs/bincode /// [`cbor`]: https://docs.rs/cbor -#[derive(PartialOrd, Ord, PartialEq, Eq, Hash)] +#[derive(Copy, Clone, PartialOrd, Ord, PartialEq, Eq, Hash)] pub struct SecretKey([u8; constants::SECRET_KEY_SIZE]); impl_array_newtype!(SecretKey, u8, constants::SECRET_KEY_SIZE); impl_display_secret!(SecretKey); diff --git a/src/lib.rs b/src/lib.rs index a098ea498..d6b5a724f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -233,7 +233,7 @@ impl ThirtyTwoByteHash for hashes::sha256t::Hash { } /// A (hashed) message input to an ECDSA signature. -#[derive(PartialOrd, Ord, PartialEq, Eq, Hash)] +#[derive(Copy, Clone, PartialOrd, Ord, PartialEq, Eq, Hash)] pub struct Message([u8; constants::MESSAGE_SIZE]); impl_array_newtype!(Message, u8, constants::MESSAGE_SIZE); impl_pretty_debug!(Message); diff --git a/src/macros.rs b/src/macros.rs index 392291f2f..4ac30b51f 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -17,8 +17,6 @@ #[macro_export] macro_rules! impl_array_newtype { ($thing:ident, $ty:ty, $len:expr) => { - impl Copy for $thing {} - impl AsRef<[$ty; $len]> for $thing { #[inline] /// Gets a reference to the underlying array @@ -28,14 +26,6 @@ macro_rules! impl_array_newtype { } } - impl Clone for $thing { - #[inline] - fn clone(&self) -> $thing { - let &$thing(ref dat) = self; - $thing(dat.clone()) - } - } - impl core::ops::Index for $thing where [$ty]: core::ops::Index, diff --git a/src/schnorr.rs b/src/schnorr.rs index 36cfe6093..1a9c4bc14 100644 --- a/src/schnorr.rs +++ b/src/schnorr.rs @@ -14,7 +14,7 @@ use crate::SECP256K1; use crate::{constants, from_hex, impl_array_newtype, Error, Message, Secp256k1, Signing, Verification}; /// Represents a Schnorr signature. -#[derive(PartialOrd, Ord, PartialEq, Eq, Hash)] +#[derive(Copy, Clone, PartialOrd, Ord, PartialEq, Eq, Hash)] pub struct Signature([u8; constants::SCHNORR_SIGNATURE_SIZE]); impl_array_newtype!(Signature, u8, constants::SCHNORR_SIGNATURE_SIZE); impl_pretty_debug!(Signature);