diff --git a/src/chain-libs/chain-impl-mockchain/src/multiverse.rs b/src/chain-libs/chain-impl-mockchain/src/multiverse.rs index 1abf72afca..82d30fdc03 100644 --- a/src/chain-libs/chain-impl-mockchain/src/multiverse.rs +++ b/src/chain-libs/chain-impl-mockchain/src/multiverse.rs @@ -110,7 +110,7 @@ impl Multiverse { pub fn insert(&mut self, chain_length: ChainLength, k: HeaderId, st: State) -> Ref { self.states_by_chain_length .entry(chain_length) - .or_insert_with(HashSet::new) + .or_default() .insert(k); let state = Arc::new(st); self.states_by_hash diff --git a/src/chain-libs/chain-impl-mockchain/src/testing/arbitrary/address.rs b/src/chain-libs/chain-impl-mockchain/src/testing/arbitrary/address.rs index 7ae7cba9f3..7ba72c21c6 100644 --- a/src/chain-libs/chain-impl-mockchain/src/testing/arbitrary/address.rs +++ b/src/chain-libs/chain-impl-mockchain/src/testing/arbitrary/address.rs @@ -106,23 +106,20 @@ impl ArbitraryAddressDataValueVec { pub fn utxos(&self) -> Vec { self.0 .iter() - .cloned() - .filter(|x| matches!(x.address_data.kind(), Kind::Single { .. })) + .filter(|&x| matches!(x.address_data.kind(), Kind::Single { .. })).cloned() .collect() } pub fn accounts(&self) -> Vec { self.0 .iter() - .cloned() - .filter(|x| matches!(x.address_data.kind(), Kind::Account { .. })) + .filter(|&x| matches!(x.address_data.kind(), Kind::Account { .. })).cloned() .collect() } pub fn delegations(&self) -> Vec { self.0 .iter() - .cloned() - .filter(|x| matches!(x.address_data.kind(), Kind::Group { .. })) - .collect() + .filter(|&x| matches!(x.address_data.kind(), Kind::Group { .. })) + .cloned().collect() } } diff --git a/src/chain-libs/chain-impl-mockchain/src/testing/arbitrary/ledger_builder.rs b/src/chain-libs/chain-impl-mockchain/src/testing/arbitrary/ledger_builder.rs index 957d064db5..80a442a749 100644 --- a/src/chain-libs/chain-impl-mockchain/src/testing/arbitrary/ledger_builder.rs +++ b/src/chain-libs/chain-impl-mockchain/src/testing/arbitrary/ledger_builder.rs @@ -23,7 +23,7 @@ impl Arbitrary for LedgerBuilder { let faucets = WalletCollection::arbitrary(g); let splits = utils::split_vec(&faucets.0, g, 3); - let stake_pools_owners = splits.get(0).unwrap(); + let stake_pools_owners = splits.first().unwrap(); let stake_pools: Vec = stake_pools_owners .iter() .cloned() diff --git a/src/chain-libs/chain-impl-mockchain/src/testing/arbitrary/transaction.rs b/src/chain-libs/chain-impl-mockchain/src/testing/arbitrary/transaction.rs index 1845f0a14b..badaf7b838 100644 --- a/src/chain-libs/chain-impl-mockchain/src/testing/arbitrary/transaction.rs +++ b/src/chain-libs/chain-impl-mockchain/src/testing/arbitrary/transaction.rs @@ -190,8 +190,7 @@ impl AccountStatesVerifier { .0 .addresses .iter() - .cloned() - .filter(filter_accounts) + .filter(|&x| filter_accounts(x)).cloned() .map(|x| find_equal_and_sub(x, inputs)) .collect(); @@ -232,8 +231,7 @@ impl AccountStatesVerifier { fn find_equal_and_sub(x: AddressDataValue, collection: &[AddressDataValue]) -> AddressDataValue { match collection .iter() - .cloned() - .find(|y| y.address_data == x.address_data) + .find(|&y| y.address_data == x.address_data).cloned() { Some(y) => AddressDataValue::new(x.address_data, (x.value - y.value).unwrap()), None => x, @@ -243,8 +241,7 @@ fn find_equal_and_sub(x: AddressDataValue, collection: &[AddressDataValue]) -> A fn find_equal_and_add(x: AddressDataValue, collection: &[AddressDataValue]) -> AddressDataValue { match collection .iter() - .cloned() - .find(|y| y.address_data == x.address_data) + .find(|&y| y.address_data == x.address_data).cloned() { Some(y) => AddressDataValue::new(x.address_data, (x.value + y.value).unwrap()), None => x, diff --git a/src/chain-libs/chain-impl-mockchain/src/tokens/minting_policy.rs b/src/chain-libs/chain-impl-mockchain/src/tokens/minting_policy.rs index 5e2725358c..07209f1d20 100644 --- a/src/chain-libs/chain-impl-mockchain/src/tokens/minting_policy.rs +++ b/src/chain-libs/chain-impl-mockchain/src/tokens/minting_policy.rs @@ -49,7 +49,7 @@ impl MintingPolicy { if self.0.is_empty() { return Err(MintingPolicyViolation::AdditionalMintingNotAllowed); } - + #[allow(clippy::never_loop)] for _entry in &self.0 { unreachable!("implement this when we have actual minting policies"); } diff --git a/src/chain-libs/chain-impl-mockchain/src/value.rs b/src/chain-libs/chain-impl-mockchain/src/value.rs index d57a3ec253..456386bdbb 100644 --- a/src/chain-libs/chain-impl-mockchain/src/value.rs +++ b/src/chain-libs/chain-impl-mockchain/src/value.rs @@ -31,7 +31,7 @@ impl Value { where I: Iterator, { - values.fold(Ok(Value::zero()), |acc, v| acc? + v) + values.try_fold(Value::zero(), |acc, v| acc? + v) } #[inline]