From 630fc1fcb6d8dd9e3f454859ba971fad5cfd2e79 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Thu, 17 Nov 2022 11:00:03 +1100 Subject: [PATCH] Remove len and is_empty from impl_array_newtype macros An array in Rust has no concept of length, it is a fixed size data type. Equally an array cannot be "empty", again since it is a fixed size data type. These are methods/concepts seen in slices and vectors. Remove the `len` and `is_empty` methods. --- secp256k1-sys/src/macros.rs | 10 ---------- src/macros.rs | 10 ---------- 2 files changed, 20 deletions(-) diff --git a/secp256k1-sys/src/macros.rs b/secp256k1-sys/src/macros.rs index a3dd1b1..761ab94 100644 --- a/secp256k1-sys/src/macros.rs +++ b/secp256k1-sys/src/macros.rs @@ -19,16 +19,6 @@ macro_rules! impl_array_newtype { ($thing:ident, $ty:ty, $len:expr) => { impl Copy for $thing {} - impl $thing { - /// Returns the length of the object as an array. - #[inline] - pub fn len(&self) -> usize { $len } - - /// Returns whether the object as an array is empty. - #[inline] - pub fn is_empty(&self) -> bool { false } - } - impl AsRef<[$ty; $len]> for $thing { #[inline] /// Gets a reference to the underlying array diff --git a/src/macros.rs b/src/macros.rs index 8245cda..b457c02 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -19,16 +19,6 @@ macro_rules! impl_array_newtype { ($thing:ident, $ty:ty, $len:expr) => { impl Copy for $thing {} - impl $thing { - /// Returns the length of the object as an array. - #[inline] - pub fn len(&self) -> usize { $len } - - /// Returns whether the object as an array is empty. - #[inline] - pub fn is_empty(&self) -> bool { false } - } - impl AsRef<[$ty; $len]> for $thing { #[inline] /// Gets a reference to the underlying array