From 60887521b6bd2dc18052b2bea750a7c825b62801 Mon Sep 17 00:00:00 2001 From: Sean Bowe Date: Tue, 3 Oct 2017 14:35:00 -0600 Subject: [PATCH] Derive `Clone` for {G1|G2}{Uncompressed|Compressed}. --- src/bls12_381/ec.rs | 32 ++++---------------------------- src/lib.rs | 1 - 2 files changed, 4 insertions(+), 29 deletions(-) diff --git a/src/bls12_381/ec.rs b/src/bls12_381/ec.rs index f441cca..c5486d6 100644 --- a/src/bls12_381/ec.rs +++ b/src/bls12_381/ec.rs @@ -591,15 +591,9 @@ pub mod g1 { curve_impl!("G1", G1, G1Affine, G1Prepared, Fq, Fr, G1Uncompressed, G1Compressed, G2Affine); - #[derive(Copy)] + #[derive(Copy, Clone)] pub struct G1Uncompressed([u8; 96]); - impl Clone for G1Uncompressed { - fn clone(&self) -> G1Uncompressed { - G1Uncompressed(self.0) - } - } - impl AsRef<[u8]> for G1Uncompressed { fn as_ref(&self) -> &[u8] { &self.0 @@ -699,15 +693,9 @@ pub mod g1 { } } - #[derive(Copy)] + #[derive(Copy, Clone)] pub struct G1Compressed([u8; 48]); - impl Clone for G1Compressed { - fn clone(&self) -> G1Compressed { - G1Compressed(self.0) - } - } - impl AsRef<[u8]> for G1Compressed { fn as_ref(&self) -> &[u8] { &self.0 @@ -1100,15 +1088,9 @@ pub mod g2 { curve_impl!("G2", G2, G2Affine, G2Prepared, Fq2, Fr, G2Uncompressed, G2Compressed, G1Affine); - #[derive(Copy)] + #[derive(Copy, Clone)] pub struct G2Uncompressed([u8; 192]); - impl Clone for G2Uncompressed { - fn clone(&self) -> G2Uncompressed { - G2Uncompressed(self.0) - } - } - impl AsRef<[u8]> for G2Uncompressed { fn as_ref(&self) -> &[u8] { &self.0 @@ -1220,15 +1202,9 @@ pub mod g2 { } } - #[derive(Copy)] + #[derive(Copy, Clone)] pub struct G2Compressed([u8; 96]); - impl Clone for G2Compressed { - fn clone(&self) -> G2Compressed { - G2Compressed(self.0) - } - } - impl AsRef<[u8]> for G2Compressed { fn as_ref(&self) -> &[u8] { &self.0 diff --git a/src/lib.rs b/src/lib.rs index c39615c..e2090b8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -13,7 +13,6 @@ #![cfg_attr(feature = "clippy", allow(too_many_arguments))] #![cfg_attr(feature = "clippy", allow(unreadable_literal))] #![cfg_attr(feature = "clippy", allow(new_without_default_derive))] -#![cfg_attr(feature = "clippy", allow(expl_impl_clone_on_copy))] // TODO // Force public structures to implement Debug #![deny(missing_debug_implementations)]