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 {
fn to_cpp(
fn into_cpp(
self,
network: Network,
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]

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>(
// Consensus branch id
cbranch: u32,

View File

@ -2,8 +2,6 @@ use incrementalmerkletree::{
bridgetree::{self, BridgeTree},
Altitude, Frontier, Hashable, Tree,
};
use std::convert::TryFrom;
use std::io;
use std::mem::size_of_val;
use std::ptr;
@ -55,14 +53,7 @@ pub extern "C" fn orchard_merkle_frontier_parse(
) -> *mut bridgetree::Frontier<MerkleCrhOrchardOutput, MERKLE_DEPTH> {
let reader = CppStreamReader::from_raw_parts(stream, read_cb.unwrap());
match read_frontier_v1(reader).and_then(|nf| {
bridgetree::Frontier::try_from(nf).map_err(|e| {
io::Error::new(
io::ErrorKind::InvalidInput,
format!("Parsing resulted in an invalid Merkle frontier: {:?}", e),
)
})
}) {
match read_frontier_v1(reader) {
Ok(parsed) => Box::into_raw(Box::new(parsed)),
Err(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
let proof_generation_key = ProofGenerationKey {
ak: ak.clone(),
nsk,
};
let proof_generation_key = ProofGenerationKey { ak, nsk };
// Grab the diversifier from the caller
let diversifier = Diversifier(unsafe { *diversifier });

View File

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

View File

@ -491,7 +491,7 @@ fn redjubjub_signatures() {
{
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);
}
{