clippy: Fix small lints
This commit is contained in:
parent
564c2714fe
commit
56b577b31e
|
@ -1,5 +1,6 @@
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[allow(clippy::eq_op)]
|
||||
#[test]
|
||||
fn it_works() {
|
||||
assert_eq!(2 + 2, 4);
|
||||
|
|
|
@ -80,9 +80,9 @@ impl Payment {
|
|||
/// internally, so payments must be normalized prior to being passed to the comparison function
|
||||
/// returned from this method.
|
||||
#[cfg(any(test, feature = "test-dependencies"))]
|
||||
pub(in crate::zip321) fn compare_normalized<'a, P: consensus::Parameters>(
|
||||
params: &'a P,
|
||||
) -> impl Fn(&Payment, &Payment) -> Ordering + 'a {
|
||||
pub(in crate::zip321) fn compare_normalized<P: consensus::Parameters>(
|
||||
params: &P,
|
||||
) -> impl Fn(&Payment, &Payment) -> Ordering + '_ {
|
||||
move |a: &Payment, b: &Payment| {
|
||||
let a_addr = a.recipient_address.encode(params);
|
||||
let b_addr = b.recipient_address.encode(params);
|
||||
|
|
|
@ -207,8 +207,10 @@ impl NodeData {
|
|||
#[cfg(test)]
|
||||
impl quickcheck::Arbitrary for NodeData {
|
||||
fn arbitrary<G: quickcheck::Gen>(gen: &mut G) -> Self {
|
||||
let mut node_data = NodeData::default();
|
||||
node_data.consensus_branch_id = 0;
|
||||
let mut node_data = NodeData {
|
||||
consensus_branch_id: 0,
|
||||
..Default::default()
|
||||
};
|
||||
gen.fill_bytes(&mut node_data.subtree_commitment[..]);
|
||||
node_data.start_time = gen.next_u32();
|
||||
node_data.end_time = gen.next_u32();
|
||||
|
|
|
@ -651,7 +651,7 @@ mod tests {
|
|||
}
|
||||
|
||||
fn leaf_count(number: u32) -> TestResult {
|
||||
if number > 1024 * 1024 || number < 3 {
|
||||
if !(3..=1024 * 1024).contains(&number) {
|
||||
TestResult::discard()
|
||||
} else {
|
||||
let mut tree = initial();
|
||||
|
@ -666,7 +666,7 @@ mod tests {
|
|||
}
|
||||
|
||||
fn parity(number: u32) -> TestResult {
|
||||
if number > 2048 * 2048 || number < 3 {
|
||||
if !(3..=2048 * 2048).contains(&number) {
|
||||
TestResult::discard()
|
||||
} else {
|
||||
let mut tree = initial();
|
||||
|
|
|
@ -41,7 +41,7 @@ impl Amount {
|
|||
///
|
||||
/// Returns an error if the amount is outside the range `{0..MAX_MONEY}`.
|
||||
pub fn from_nonnegative_i64(amount: i64) -> Result<Self, ()> {
|
||||
if 0 <= amount && amount <= MAX_MONEY {
|
||||
if (0..=MAX_MONEY).contains(&amount) {
|
||||
Ok(Amount(amount))
|
||||
} else {
|
||||
Err(())
|
||||
|
|
|
@ -227,11 +227,11 @@ impl<'a> SignableInput<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn signature_hash_data<'a>(
|
||||
pub fn signature_hash_data(
|
||||
tx: &TransactionData,
|
||||
consensus_branch_id: consensus::BranchId,
|
||||
hash_type: u32,
|
||||
signable_input: SignableInput<'a>,
|
||||
signable_input: SignableInput<'_>,
|
||||
) -> Vec<u8> {
|
||||
if has_overwinter_components(&tx.version) {
|
||||
let mut personal = [0; 16];
|
||||
|
@ -372,11 +372,11 @@ pub fn signature_hash_data<'a>(
|
|||
}
|
||||
}
|
||||
|
||||
pub fn signature_hash<'a>(
|
||||
pub fn signature_hash(
|
||||
tx: &Transaction,
|
||||
consensus_branch_id: consensus::BranchId,
|
||||
hash_type: u32,
|
||||
signable_input: SignableInput<'a>,
|
||||
signable_input: SignableInput<'_>,
|
||||
) -> Vec<u8> {
|
||||
signature_hash_data(tx, consensus_branch_id, hash_type, signable_input)
|
||||
}
|
||||
|
|
|
@ -586,7 +586,7 @@ mod tests {
|
|||
d1: Option<[u8; 11]>,
|
||||
d2: Option<[u8; 11]>,
|
||||
dmax: Option<[u8; 11]>,
|
||||
};
|
||||
}
|
||||
|
||||
// From https://github.com/zcash-hackworks/zcash-test-vectors/blob/master/sapling_zip32.py
|
||||
let test_vectors = vec![
|
||||
|
|
Loading…
Reference in New Issue