Skip to content

Commit e016ba9

Browse files
committed
nits from cargo test and cargo clippy on latest nightly
The newest nightly has a new "unused mut" warning which is causing CI to fail. Fix that, and while we're at it, run clippy. And while we're at that, remove some `#[deny]` conditions from the crate root since these properly belong in CI (via -D warnings) rather than in the source.
1 parent 63ba343 commit e016ba9

File tree

3 files changed

+26
-6
lines changed

3 files changed

+26
-6
lines changed

secp256k1-zkp-sys/src/zkp.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,12 @@ impl PartialEq for SurjectionProof {
426426

427427
impl Eq for SurjectionProof {}
428428

429+
impl Default for SurjectionProof {
430+
fn default() -> Self {
431+
SurjectionProof::new()
432+
}
433+
}
434+
429435
impl hash::Hash for SurjectionProof {
430436
fn hash<H: hash::Hasher>(&self, state: &mut H) {
431437
self.n_inputs.hash(state);
@@ -527,7 +533,7 @@ impl Default for PedersenCommitment {
527533
#[cfg(not(fuzzing))]
528534
impl PartialEq for PedersenCommitment {
529535
fn eq(&self, other: &Self) -> bool {
530-
&self.0[..] == &other.0[..]
536+
self.0[..] == other.0[..]
531537
}
532538
}
533539

@@ -594,6 +600,12 @@ pub struct EcdsaAdaptorSignature([u8; ECDSA_ADAPTOR_SIGNATURE_LENGTH]);
594600
impl_array_newtype!(EcdsaAdaptorSignature, u8, ECDSA_ADAPTOR_SIGNATURE_LENGTH);
595601
impl_raw_debug!(EcdsaAdaptorSignature);
596602

603+
impl Default for EcdsaAdaptorSignature {
604+
fn default() -> EcdsaAdaptorSignature {
605+
EcdsaAdaptorSignature::new()
606+
}
607+
}
608+
597609
impl EcdsaAdaptorSignature {
598610
/// Create a new (zeroed) ecdsa adaptor signature usable for the FFI interface
599611
pub fn new() -> Self {
@@ -617,7 +629,7 @@ impl EcdsaAdaptorSignature {
617629
#[cfg(not(fuzzing))]
618630
impl PartialEq for EcdsaAdaptorSignature {
619631
fn eq(&self, other: &Self) -> bool {
620-
&self.0[..] == &other.0[..]
632+
self.0[..] == other.0[..]
621633
}
622634
}
623635

src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@
3333
#![cfg_attr(all(not(test), not(feature = "std")), no_std)]
3434
#![cfg_attr(all(test, feature = "unstable"), feature(test))]
3535

36-
/// Re-export secp256k1_zkp_sys
36+
/// Re-export of the internal FFI bindings crate
3737
pub extern crate secp256k1_zkp_sys;
38+
/// Re-export of the internal FFI bindings crate under the alternate name `ffi`
3839
pub use secp256k1_zkp_sys as ffi;
3940

4041
extern crate secp256k1;
@@ -43,13 +44,12 @@ extern crate secp256k1;
4344
pub use secp256k1::hashes;
4445
#[cfg(any(test, feature = "std"))]
4546
extern crate core;
46-
/// Re-export rand
47+
/// Re-export of the `rand` crate
4748
#[cfg(any(test, feature = "rand"))]
4849
pub extern crate rand;
49-
/// Re-export rand_core
5050
#[cfg(test)]
5151
extern crate rand_core;
52-
/// Re-export serde
52+
/// Re-export of the `serde` crate
5353
#[cfg(feature = "serde")]
5454
pub extern crate serde;
5555
#[cfg(all(test, feature = "serde"))]

src/zkp/surjection_proof.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,14 @@ impl SurjectionProof {
153153
}
154154
}
155155

156+
/// Whether the proof has zero length
157+
///
158+
/// Always returns `false` since a surjection proof must contain at least
159+
/// one 32-byte hash.
160+
pub fn is_empty(&self) -> bool {
161+
false
162+
}
163+
156164
/// Verify a surjection proof.
157165
#[must_use]
158166
pub fn verify<C: Verification>(

0 commit comments

Comments
 (0)