Skip to content

Commit

Permalink
fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
kukkok3 committed Feb 21, 2024
1 parent 3430311 commit 69b594e
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/chain-libs/chain-impl-mockchain/src/multiverse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ impl<State> Multiverse<State> {
pub fn insert(&mut self, chain_length: ChainLength, k: HeaderId, st: State) -> Ref<State> {
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,23 +106,20 @@ impl ArbitraryAddressDataValueVec {
pub fn utxos(&self) -> Vec<AddressDataValue> {
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<AddressDataValue> {
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<AddressDataValue> {
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()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<StakePool> = stake_pools_owners
.iter()
.cloned()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down
2 changes: 1 addition & 1 deletion src/chain-libs/chain-impl-mockchain/src/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl Value {
where
I: Iterator<Item = Self>,
{
values.fold(Ok(Value::zero()), |acc, v| acc? + v)
values.try_fold(Value::zero(), |acc, v| acc? + v)
}

#[inline]
Expand Down

0 comments on commit 69b594e

Please sign in to comment.