Skip to content

nits from cargo test and cargo clippy on latest nightly #65

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions secp256k1-zkp-sys/src/zkp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,12 @@ impl PartialEq for SurjectionProof {

impl Eq for SurjectionProof {}

impl Default for SurjectionProof {
fn default() -> Self {
SurjectionProof::new()
}
}

impl hash::Hash for SurjectionProof {
fn hash<H: hash::Hasher>(&self, state: &mut H) {
self.n_inputs.hash(state);
Expand Down Expand Up @@ -527,7 +533,7 @@ impl Default for PedersenCommitment {
#[cfg(not(fuzzing))]
impl PartialEq for PedersenCommitment {
fn eq(&self, other: &Self) -> bool {
&self.0[..] == &other.0[..]
self.0[..] == other.0[..]
}
}

Expand Down Expand Up @@ -594,6 +600,12 @@ pub struct EcdsaAdaptorSignature([u8; ECDSA_ADAPTOR_SIGNATURE_LENGTH]);
impl_array_newtype!(EcdsaAdaptorSignature, u8, ECDSA_ADAPTOR_SIGNATURE_LENGTH);
impl_raw_debug!(EcdsaAdaptorSignature);

impl Default for EcdsaAdaptorSignature {
fn default() -> EcdsaAdaptorSignature {
EcdsaAdaptorSignature::new()
}
}

impl EcdsaAdaptorSignature {
/// Create a new (zeroed) ecdsa adaptor signature usable for the FFI interface
pub fn new() -> Self {
Expand All @@ -617,7 +629,7 @@ impl EcdsaAdaptorSignature {
#[cfg(not(fuzzing))]
impl PartialEq for EcdsaAdaptorSignature {
fn eq(&self, other: &Self) -> bool {
&self.0[..] == &other.0[..]
self.0[..] == other.0[..]
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@
#![cfg_attr(all(not(test), not(feature = "std")), no_std)]
#![cfg_attr(all(test, feature = "unstable"), feature(test))]

/// Re-export secp256k1_zkp_sys
/// Re-export of the internal FFI bindings crate
pub extern crate secp256k1_zkp_sys;
/// Re-export of the internal FFI bindings crate under the alternate name `ffi`
pub use secp256k1_zkp_sys as ffi;

extern crate secp256k1;
Expand All @@ -43,13 +44,12 @@ extern crate secp256k1;
pub use secp256k1::hashes;
#[cfg(any(test, feature = "std"))]
extern crate core;
/// Re-export rand
/// Re-export of the `rand` crate
#[cfg(any(test, feature = "rand"))]
pub extern crate rand;
/// Re-export rand_core
#[cfg(test)]
extern crate rand_core;
/// Re-export serde
/// Re-export of the `serde` crate
#[cfg(feature = "serde")]
pub extern crate serde;
#[cfg(all(test, feature = "serde"))]
Expand Down
8 changes: 8 additions & 0 deletions src/zkp/surjection_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,14 @@ impl SurjectionProof {
}
}

/// Whether the proof has zero length
///
/// Always returns `false` since a surjection proof must contain at least
/// one 32-byte hash.
pub fn is_empty(&self) -> bool {
false
}

/// Verify a surjection proof.
#[must_use]
pub fn verify<C: Verification>(
Expand Down