From a4ccab7431696af68403a6199fa927112e2b6ad5 Mon Sep 17 00:00:00 2001 From: Rodolfo Araujo Date: Sun, 17 Nov 2019 22:04:11 -0300 Subject: [PATCH 1/3] Libraries. --- Cargo.toml | 12 ++++++------ src/key.rs | 8 ++++---- src/macros.rs | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 94263be..58388c6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "secp256k1" -version = "0.16.0" +version = "0.16.1" authors = [ "Dawid Ciężarkiewicz ", "Andrew Poelstra " ] license = "CC0-1.0" @@ -41,10 +41,10 @@ dont_replace_c_symbols = [] fuzztarget = [] [dev-dependencies] -rand = "0.6" -rand_core = "0.4" -serde_test = "1.0" -bitcoin_hashes = "0.7" +rand = "0.6.5" +rand_core = "0.4.2" +serde_test = "1.0.102" +bitcoin_hashes = "0.7.1" [dependencies.rand] version = "0.6" @@ -65,4 +65,4 @@ name = "sign_verify" [[example]] name = "generate_keys" -required-features = ["rand"] \ No newline at end of file +required-features = ["rand"] diff --git a/src/key.rs b/src/key.rs index 38f3cdf..ba1d221 100644 --- a/src/key.rs +++ b/src/key.rs @@ -619,13 +619,13 @@ mod test { fn next_u64(&mut self) -> u64 { self.next_u32() as u64 } - fn try_fill_bytes(&mut self, _dest: &mut [u8]) -> Result<(), Error> { - Err(Error::new(ErrorKind::Unavailable, "not implemented")) - } - fn fill_bytes(&mut self, dest: &mut [u8]) { impls::fill_bytes_via_next(self, dest); } + + fn try_fill_bytes(&mut self, _dest: &mut [u8]) -> Result<(), Error> { + Err(Error::new(ErrorKind::Unavailable, "not implemented")) + } } let s = Secp256k1::new(); diff --git a/src/macros.rs b/src/macros.rs index 6a8354f..c360796 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -147,9 +147,9 @@ macro_rules! impl_pretty_debug { ($thing:ident) => { impl ::core::fmt::Debug for $thing { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - try!(write!(f, "{}(", stringify!($thing))); + write!(f, "{}(", stringify!($thing))?; for i in self[..].iter().cloned() { - try!(write!(f, "{:02x}", i)); + write!(f, "{:02x}", i)?; } write!(f, ")") } @@ -162,7 +162,7 @@ macro_rules! impl_raw_debug { impl ::core::fmt::Debug for $thing { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { for i in self[..].iter().cloned() { - try!(write!(f, "{:02x}", i)); + write!(f, "{:02x}", i)?; } Ok(()) } From 825493bea92c93a438d593715ae71f42e3c0ddcd Mon Sep 17 00:00:00 2001 From: Rodolfo Araujo Date: Sun, 17 Nov 2019 22:10:40 -0300 Subject: [PATCH 2/3] Small code improvements. --- src/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 854b166..7b38d34 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -247,6 +247,9 @@ impl SerializedSignature { pub fn from_signature(sig: &Signature) -> SerializedSignature { sig.serialize_der() } + + /// Check if the space is zero. + pub fn is_empty(&self) -> bool { self.len() == 0 } } impl Signature { @@ -548,7 +551,7 @@ impl Default for SerializedSignature { impl PartialEq for SerializedSignature { fn eq(&self, other: &SerializedSignature) -> bool { - &self.data[..self.len] == &other.data[..other.len] + self.data[..self.len] == other.data[..other.len] } } From 97f74c2c066d78705a6cf560ad0aa9f8ea2701b8 Mon Sep 17 00:00:00 2001 From: Rodolfo Araujo Date: Wed, 20 Nov 2019 11:44:53 -0300 Subject: [PATCH 3/3] Libraries versions --- Cargo.toml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 58388c6..6333a93 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,10 +41,10 @@ dont_replace_c_symbols = [] fuzztarget = [] [dev-dependencies] -rand = "0.6.5" -rand_core = "0.4.2" -serde_test = "1.0.102" -bitcoin_hashes = "0.7.1" +rand = "0.6" +rand_core = "0.4" +serde_test = "1.0" +bitcoin_hashes = "0.7" [dependencies.rand] version = "0.6"