Fix clippy lints for 1.65

This commit is contained in:
Jack Grigg 2023-05-16 15:50:31 +00:00
parent 6419e1e363
commit a092da8d5d
8 changed files with 14 additions and 13 deletions

View File

@ -6,6 +6,10 @@ and this library adheres to Rust's notion of
[Semantic Versioning](https://semver.org/spec/v2.0.0.html). [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased] ## [Unreleased]
### Added
- `impl Eq for zcash_client_backend::address::RecipientAddress`
- `impl Eq for zcash_client_backend::zip321::{Payment, TransactionRequest}`
### Changed ### Changed
- MSRV is now 1.65.0. - MSRV is now 1.65.0.
- Bumped dependencies to `hdwallet 0.4`. - Bumped dependencies to `hdwallet 0.4`.

View File

@ -174,7 +174,7 @@ impl UnifiedAddress {
/// An address that funds can be sent to. /// An address that funds can be sent to.
// TODO: rename to ParsedAddress // TODO: rename to ParsedAddress
#[derive(Debug, PartialEq, Clone)] #[derive(Debug, PartialEq, Eq, Clone)]
pub enum RecipientAddress { pub enum RecipientAddress {
Shielded(PaymentAddress), Shielded(PaymentAddress),
Transparent(TransparentAddress), Transparent(TransparentAddress),

View File

@ -434,10 +434,7 @@ where
Ok(balance) => balance, Ok(balance) => balance,
Err(ChangeError::DustInputs { transparent, .. }) => { Err(ChangeError::DustInputs { transparent, .. }) => {
let exclusions: BTreeSet<OutPoint> = transparent.into_iter().collect(); let exclusions: BTreeSet<OutPoint> = transparent.into_iter().collect();
transparent_inputs = transparent_inputs transparent_inputs.retain(|i| !exclusions.contains(i.outpoint()));
.into_iter()
.filter(|i| !exclusions.contains(i.outpoint()))
.collect();
self.change_strategy.compute_balance( self.change_strategy.compute_balance(
params, params,

View File

@ -53,7 +53,7 @@ pub fn memo_from_base64(s: &str) -> Result<MemoBytes, Zip321Error> {
} }
/// A single payment being requested. /// A single payment being requested.
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq, Eq)]
pub struct Payment { pub struct Payment {
/// The payment address to which the payment should be sent. /// The payment address to which the payment should be sent.
pub recipient_address: RecipientAddress, pub recipient_address: RecipientAddress,
@ -111,7 +111,7 @@ impl Payment {
/// When constructing a transaction in response to such a request, /// When constructing a transaction in response to such a request,
/// a separate output should be added to the transaction for each /// a separate output should be added to the transaction for each
/// payment value in the request. /// payment value in the request.
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq, Eq)]
pub struct TransactionRequest { pub struct TransactionRequest {
payments: Vec<Payment>, payments: Vec<Payment>,
} }
@ -402,7 +402,7 @@ mod parse {
/// A data type that defines the possible parameter types which may occur within a /// A data type that defines the possible parameter types which may occur within a
/// ZIP 321 URI. /// ZIP 321 URI.
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq, Eq)]
pub enum Param { pub enum Param {
Addr(Box<RecipientAddress>), Addr(Box<RecipientAddress>),
Amount(Amount), Amount(Amount),

View File

@ -88,7 +88,7 @@ impl BlockHeader {
header header
.hash .hash
.0 .0
.copy_from_slice(&Sha256::digest(&Sha256::digest(&raw))); .copy_from_slice(&Sha256::digest(Sha256::digest(&raw)));
Ok(header) Ok(header)
} }

View File

@ -152,7 +152,7 @@ impl AccountPubKey {
#[deprecated(note = "This function will be removed from the public API in an upcoming refactor.")] #[deprecated(note = "This function will be removed from the public API in an upcoming refactor.")]
pub fn pubkey_to_address(pubkey: &secp256k1::PublicKey) -> TransparentAddress { pub fn pubkey_to_address(pubkey: &secp256k1::PublicKey) -> TransparentAddress {
TransparentAddress::PublicKey( TransparentAddress::PublicKey(
*ripemd::Ripemd160::digest(Sha256::digest(&pubkey.serialize())).as_ref(), *ripemd::Ripemd160::digest(Sha256::digest(pubkey.serialize())).as_ref(),
) )
} }

View File

@ -146,7 +146,7 @@ impl TransparentBuilder {
use ripemd::Ripemd160; use ripemd::Ripemd160;
use sha2::Sha256; use sha2::Sha256;
if hash[..] != Ripemd160::digest(Sha256::digest(&pubkey))[..] { if hash[..] != Ripemd160::digest(Sha256::digest(pubkey))[..] {
return Err(Error::InvalidAddress); return Err(Error::InvalidAddress);
} }
} }

View File

@ -22,7 +22,7 @@ impl<R: Read> HashReader<R> {
/// Destroy this reader and return the hash of what was read. /// Destroy this reader and return the hash of what was read.
pub fn into_hash(self) -> Output<Sha256> { pub fn into_hash(self) -> Output<Sha256> {
Sha256::digest(&self.hasher.finalize()) Sha256::digest(self.hasher.finalize())
} }
} }
@ -54,7 +54,7 @@ impl Default for HashWriter {
impl HashWriter { impl HashWriter {
/// Destroy this writer and return the hash of what was written. /// Destroy this writer and return the hash of what was written.
pub fn into_hash(self) -> Output<Sha256> { pub fn into_hash(self) -> Output<Sha256> {
Sha256::digest(&self.hasher.finalize()) Sha256::digest(self.hasher.finalize())
} }
} }