Derive Clone for {G1|G2}{Uncompressed|Compressed}.

This commit is contained in:
Sean Bowe 2017-10-03 14:35:00 -06:00
parent a8bf8362da
commit 60887521b6
No known key found for this signature in database
GPG Key ID: 95684257D8F8B031
2 changed files with 4 additions and 29 deletions

@ -591,15 +591,9 @@ pub mod g1 {
curve_impl!("G1", G1, G1Affine, G1Prepared, Fq, Fr, G1Uncompressed, G1Compressed, G2Affine); curve_impl!("G1", G1, G1Affine, G1Prepared, Fq, Fr, G1Uncompressed, G1Compressed, G2Affine);
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct G1Uncompressed([u8; 96]); pub struct G1Uncompressed([u8; 96]);
impl Clone for G1Uncompressed {
fn clone(&self) -> G1Uncompressed {
G1Uncompressed(self.0)
}
}
impl AsRef<[u8]> for G1Uncompressed { impl AsRef<[u8]> for G1Uncompressed {
fn as_ref(&self) -> &[u8] { fn as_ref(&self) -> &[u8] {
&self.0 &self.0
@ -699,15 +693,9 @@ pub mod g1 {
} }
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct G1Compressed([u8; 48]); pub struct G1Compressed([u8; 48]);
impl Clone for G1Compressed {
fn clone(&self) -> G1Compressed {
G1Compressed(self.0)
}
}
impl AsRef<[u8]> for G1Compressed { impl AsRef<[u8]> for G1Compressed {
fn as_ref(&self) -> &[u8] { fn as_ref(&self) -> &[u8] {
&self.0 &self.0
@ -1100,15 +1088,9 @@ pub mod g2 {
curve_impl!("G2", G2, G2Affine, G2Prepared, Fq2, Fr, G2Uncompressed, G2Compressed, G1Affine); curve_impl!("G2", G2, G2Affine, G2Prepared, Fq2, Fr, G2Uncompressed, G2Compressed, G1Affine);
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct G2Uncompressed([u8; 192]); pub struct G2Uncompressed([u8; 192]);
impl Clone for G2Uncompressed {
fn clone(&self) -> G2Uncompressed {
G2Uncompressed(self.0)
}
}
impl AsRef<[u8]> for G2Uncompressed { impl AsRef<[u8]> for G2Uncompressed {
fn as_ref(&self) -> &[u8] { fn as_ref(&self) -> &[u8] {
&self.0 &self.0
@ -1220,15 +1202,9 @@ pub mod g2 {
} }
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct G2Compressed([u8; 96]); pub struct G2Compressed([u8; 96]);
impl Clone for G2Compressed {
fn clone(&self) -> G2Compressed {
G2Compressed(self.0)
}
}
impl AsRef<[u8]> for G2Compressed { impl AsRef<[u8]> for G2Compressed {
fn as_ref(&self) -> &[u8] { fn as_ref(&self) -> &[u8] {
&self.0 &self.0

@ -13,7 +13,6 @@
#![cfg_attr(feature = "clippy", allow(too_many_arguments))] #![cfg_attr(feature = "clippy", allow(too_many_arguments))]
#![cfg_attr(feature = "clippy", allow(unreadable_literal))] #![cfg_attr(feature = "clippy", allow(unreadable_literal))]
#![cfg_attr(feature = "clippy", allow(new_without_default_derive))] #![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 // Force public structures to implement Debug
#![deny(missing_debug_implementations)] #![deny(missing_debug_implementations)]