diff --git a/secp256k1-sys/src/macros.rs b/secp256k1-sys/src/macros.rs index 98499ff76..35734fcce 100644 --- a/secp256k1-sys/src/macros.rs +++ b/secp256k1-sys/src/macros.rs @@ -45,15 +45,6 @@ macro_rules! impl_array_newtype { } } - impl AsRef<[$ty; $len]> for $thing { - #[inline] - /// Gets a reference to the underlying array - fn as_ref(&self) -> &[$ty; $len] { - let &$thing(ref dat) = self; - dat - } - } - // We cannot derive these traits because Rust 1.41.1 requires `std::array::LengthAtMost32`. #[cfg(fuzzing)] @@ -90,6 +81,15 @@ macro_rules! impl_array_newtype { } } + impl AsRef<[$ty; $len]> for $thing { + #[inline] + /// Gets a reference to the underlying array + fn as_ref(&self) -> &[$ty; $len] { + let &$thing(ref dat) = self; + dat + } + } + impl core::ops::Index for $thing where [$ty]: core::ops::Index, diff --git a/src/macros.rs b/src/macros.rs index 1ed2bd135..e89e8d07d 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -18,15 +18,6 @@ macro_rules! impl_array_newtype { ($thing:ident, $ty:ty, $len:expr) => { - impl AsRef<[$ty; $len]> for $thing { - #[inline] - /// Gets a reference to the underlying array - fn as_ref(&self) -> &[$ty; $len] { - let &$thing(ref dat) = self; - dat - } - } - // We cannot derive these traits because Rust 1.41.1 requires `std::array::LengthAtMost32`. impl PartialEq for $thing { @@ -58,6 +49,15 @@ macro_rules! impl_array_newtype { } } + impl AsRef<[$ty; $len]> for $thing { + #[inline] + /// Gets a reference to the underlying array + fn as_ref(&self) -> &[$ty; $len] { + let &$thing(ref dat) = self; + dat + } + } + impl core::ops::Index for $thing where [$ty]: core::ops::Index,