Skip to content

Commit 47b2555

Browse files
authored
Merge pull request #182 from rodoufu/code_imp
Updating libraries and small code improvements
2 parents 30ea7f8 + 97f74c2 commit 47b2555

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22

33
name = "secp256k1"
4-
version = "0.16.0"
4+
version = "0.16.1"
55
authors = [ "Dawid Ciężarkiewicz <dpc@ucore.info>",
66
"Andrew Poelstra <apoelstra@wpsoftware.net>" ]
77
license = "CC0-1.0"
@@ -65,4 +65,4 @@ name = "sign_verify"
6565

6666
[[example]]
6767
name = "generate_keys"
68-
required-features = ["rand"]
68+
required-features = ["rand"]

src/key.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -619,13 +619,13 @@ mod test {
619619
fn next_u64(&mut self) -> u64 {
620620
self.next_u32() as u64
621621
}
622-
fn try_fill_bytes(&mut self, _dest: &mut [u8]) -> Result<(), Error> {
623-
Err(Error::new(ErrorKind::Unavailable, "not implemented"))
624-
}
625-
626622
fn fill_bytes(&mut self, dest: &mut [u8]) {
627623
impls::fill_bytes_via_next(self, dest);
628624
}
625+
626+
fn try_fill_bytes(&mut self, _dest: &mut [u8]) -> Result<(), Error> {
627+
Err(Error::new(ErrorKind::Unavailable, "not implemented"))
628+
}
629629
}
630630

631631
let s = Secp256k1::new();

src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,9 @@ impl SerializedSignature {
247247
pub fn from_signature(sig: &Signature) -> SerializedSignature {
248248
sig.serialize_der()
249249
}
250+
251+
/// Check if the space is zero.
252+
pub fn is_empty(&self) -> bool { self.len() == 0 }
250253
}
251254

252255
impl Signature {
@@ -548,7 +551,7 @@ impl Default for SerializedSignature {
548551

549552
impl PartialEq for SerializedSignature {
550553
fn eq(&self, other: &SerializedSignature) -> bool {
551-
&self.data[..self.len] == &other.data[..other.len]
554+
self.data[..self.len] == other.data[..other.len]
552555
}
553556
}
554557

src/macros.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@ macro_rules! impl_pretty_debug {
147147
($thing:ident) => {
148148
impl ::core::fmt::Debug for $thing {
149149
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
150-
try!(write!(f, "{}(", stringify!($thing)));
150+
write!(f, "{}(", stringify!($thing))?;
151151
for i in self[..].iter().cloned() {
152-
try!(write!(f, "{:02x}", i));
152+
write!(f, "{:02x}", i)?;
153153
}
154154
write!(f, ")")
155155
}
@@ -162,7 +162,7 @@ macro_rules! impl_raw_debug {
162162
impl ::core::fmt::Debug for $thing {
163163
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
164164
for i in self[..].iter().cloned() {
165-
try!(write!(f, "{:02x}", i));
165+
write!(f, "{:02x}", i)?;
166166
}
167167
Ok(())
168168
}

0 commit comments

Comments
 (0)