Fix clippy complaints.

This commit is contained in:
Kris Nuttycombe 2021-08-24 09:54:01 -06:00
parent a61318ec85
commit b8e86ddc44
6 changed files with 8 additions and 20 deletions

View File

@ -50,7 +50,7 @@ impl FromAddress for UnifiedAddressHelper {
} }
impl UnifiedAddressHelper { impl UnifiedAddressHelper {
fn to_cpp( fn into_cpp(
self, self,
network: Network, network: Network,
ua_obj: Option<UnifiedAddressObj>, ua_obj: Option<UnifiedAddressObj>,
@ -145,7 +145,7 @@ pub extern "C" fn zcash_address_parse_unified(
} }
}; };
ua.to_cpp(network, ua_obj, sapling_cb, p2sh_cb, p2pkh_cb, unknown_cb) ua.into_cpp(network, ua_obj, sapling_cb, p2sh_cb, p2pkh_cb, unknown_cb)
} }
#[no_mangle] #[no_mangle]

View File

@ -88,6 +88,7 @@ pub extern "system" fn librustzcash_mmr_append(
) )
} }
#[allow(clippy::too_many_arguments)]
fn librustzcash_mmr_append_inner<V: Version>( fn librustzcash_mmr_append_inner<V: Version>(
// Consensus branch id // Consensus branch id
cbranch: u32, cbranch: u32,

View File

@ -2,8 +2,6 @@ use incrementalmerkletree::{
bridgetree::{self, BridgeTree}, bridgetree::{self, BridgeTree},
Altitude, Frontier, Hashable, Tree, Altitude, Frontier, Hashable, Tree,
}; };
use std::convert::TryFrom;
use std::io;
use std::mem::size_of_val; use std::mem::size_of_val;
use std::ptr; use std::ptr;
@ -55,14 +53,7 @@ pub extern "C" fn orchard_merkle_frontier_parse(
) -> *mut bridgetree::Frontier<MerkleCrhOrchardOutput, MERKLE_DEPTH> { ) -> *mut bridgetree::Frontier<MerkleCrhOrchardOutput, MERKLE_DEPTH> {
let reader = CppStreamReader::from_raw_parts(stream, read_cb.unwrap()); let reader = CppStreamReader::from_raw_parts(stream, read_cb.unwrap());
match read_frontier_v1(reader).and_then(|nf| { match read_frontier_v1(reader) {
bridgetree::Frontier::try_from(nf).map_err(|e| {
io::Error::new(
io::ErrorKind::InvalidInput,
format!("Parsing resulted in an invalid Merkle frontier: {:?}", e),
)
})
}) {
Ok(parsed) => Box::into_raw(Box::new(parsed)), Ok(parsed) => Box::into_raw(Box::new(parsed)),
Err(e) => { Err(e) => {
error!("Failed to parse Orchard bundle: {}", e); error!("Failed to parse Orchard bundle: {}", e);

View File

@ -946,10 +946,7 @@ pub extern "C" fn librustzcash_sapling_spend_proof(
}; };
// Construct the proof generation key // Construct the proof generation key
let proof_generation_key = ProofGenerationKey { let proof_generation_key = ProofGenerationKey { ak, nsk };
ak: ak.clone(),
nsk,
};
// Grab the diversifier from the caller // Grab the diversifier from the caller
let diversifier = Diversifier(unsafe { *diversifier }); let diversifier = Diversifier(unsafe { *diversifier });

View File

@ -21,9 +21,8 @@ fn test_key_agreement() {
let addr = loop { let addr = loop {
let mut d = [0; 11]; let mut d = [0; 11];
rng.fill_bytes(&mut d); rng.fill_bytes(&mut d);
match vk.to_payment_address(Diversifier(d)) { if let Some(a) = vk.to_payment_address(Diversifier(d)) {
Some(a) => break a, break a;
None => {}
} }
}; };

View File

@ -491,7 +491,7 @@ fn redjubjub_signatures() {
{ {
let mut vec = Vec::new(); let mut vec = Vec::new();
sk.randomize(alpha.clone()).write(&mut vec).unwrap(); sk.randomize(alpha).write(&mut vec).unwrap();
assert_eq!(&vec, &tv.rsk); assert_eq!(&vec, &tv.rsk);
} }
{ {