Skip to content

Commit 045fa7b

Browse files
committed
fix: resolve clippy beta channel lint failures
1 parent 7e12052 commit 045fa7b

File tree

14 files changed

+28
-30
lines changed

14 files changed

+28
-30
lines changed

crates/ledger/src/proofs/public_input/scalars.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ mod tests {
705705

706706
// HashMap deliberately uses an unstable order; here we sort to ensure that the output is
707707
// consistent when printing.
708-
index_terms_fp.sort_by(|(x, _), (y, _)| x.cmp(y));
708+
index_terms_fp.sort_by_key(|(x, _)| *x);
709709

710710
let fp_other_terms: Vec<(String, String)> = index_terms_fp
711711
.iter()
@@ -772,7 +772,7 @@ mod tests {
772772

773773
// HashMap deliberately uses an unstable order; here we sort to ensure that the output is
774774
// consistent when printing.
775-
index_terms_fq.sort_by(|(x, _), (y, _)| x.cmp(y));
775+
index_terms_fq.sort_by_key(|(x, _)| *x);
776776

777777
// dbg!(index_terms_fq)
778778

crates/ledger/src/proofs/verifiers.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,8 +399,7 @@ pub fn make_zkapp_verifier_index(vk: &VerificationKey) -> VerifierIndex<Fq> {
399399

400400
let public = 40; // Is that constant ?
401401

402-
let domain: Radix2EvaluationDomain<Fq> =
403-
Radix2EvaluationDomain::new(1 << log2_size as u64).unwrap();
402+
let domain: Radix2EvaluationDomain<Fq> = Radix2EvaluationDomain::new(1 << log2_size).unwrap();
404403

405404
let srs = {
406405
let degree = 1 << BACKEND_TOCK_ROUNDS_N;

crates/ledger/src/scan_state/transaction_logic/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -856,8 +856,8 @@ impl UserCommand {
856856
accounts: &BTreeMap<AccountId, Account>,
857857
) -> HashMap<AccountId, VerificationKeyWire> {
858858
accounts
859-
.iter()
860-
.filter_map(|(_, account)| {
859+
.values()
860+
.filter_map(|account| {
861861
let zkapp = account.zkapp.as_ref()?;
862862
let vk = zkapp.verification_key.clone()?;
863863
Some((account.id(), vk))

crates/ledger/src/transaction_pool.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1669,13 +1669,10 @@ impl TransactionPool {
16691669
fn has_sufficient_fee(&self, pool_max_size: usize, cmd: &valid::UserCommand) -> bool {
16701670
match self.pool.min_fee() {
16711671
None => true,
1672-
Some(min_fee) => {
1673-
if self.pool.size() >= pool_max_size {
1674-
cmd.forget_check().fee_per_wu() > min_fee
1675-
} else {
1676-
true
1677-
}
1672+
Some(min_fee) if self.pool.size() >= pool_max_size => {
1673+
cmd.forget_check().fee_per_wu() > min_fee
16781674
}
1675+
Some(_) => true,
16791676
}
16801677
}
16811678

crates/node/src/p2p/callbacks/p2p_callbacks_reducer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,8 +471,8 @@ impl crate::State {
471471
let p2p = p2p_ready!(state.p2p, meta.time());
472472
let peers = p2p
473473
.peers
474-
.iter()
475-
.filter_map(|(_, v)| v.dial_opts.clone())
474+
.values()
475+
.filter_map(|v| v.dial_opts.clone())
476476
.collect();
477477
let response = Some(Box::new(P2pRpcResponse::InitialPeers(peers)));
478478

crates/node/src/snark_pool/candidate/snark_pool_candidate_state.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,8 @@ impl SnarkPoolCandidatesState {
200200
let peer_jobs = self.by_peer.get(peer_id)?;
201201
if peer_jobs.get(job_id)?.work().is_some() {
202202
let jobs = peer_jobs
203-
.iter()
204-
.filter_map(|(_, v)| match v {
203+
.values()
204+
.filter_map(|v| match v {
205205
SnarkPoolCandidateState::WorkReceived { work, .. } => Some(work),
206206
_ => None,
207207
})

crates/node/src/stats/stats_sync.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,8 +426,8 @@ impl SyncBlock {
426426
match state {
427427
TransitionFrontierSyncBlockState::FetchPending { attempts, .. } => {
428428
if let Some(time) = attempts
429-
.iter()
430-
.filter_map(|(_, v)| v.fetch_pending_since())
429+
.values()
430+
.filter_map(|v| v.fetch_pending_since())
431431
.min()
432432
{
433433
self.status = SyncBlockStatus::Fetching;

crates/node/src/transaction_pool/candidate/transaction_pool_candidate_state.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,8 @@ impl TransactionPoolCandidatesState {
251251
let peer_transactions = self.by_peer.get(peer_id)?;
252252
if peer_transactions.get(hash)?.transaction().is_some() {
253253
let transactions = peer_transactions
254-
.iter()
255-
.filter_map(|(_, v)| match v {
254+
.values()
255+
.filter_map(|v| match v {
256256
TransactionPoolCandidateState::Received { transaction, .. } => {
257257
Some(transaction)
258258
}

crates/node/src/transition_frontier/sync/ledger/snarked/transition_frontier_sync_ledger_snarked_actions.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,8 @@ impl redux::EnablingCondition<crate::State> for TransitionFrontierSyncLedgerSnar
352352
.and_then(|s| s.snarked()?.fetch_pending())
353353
.is_some_and(|pending| {
354354
pending
355-
.iter()
356-
.filter_map(|(_, query_state)| query_state.attempts.get(peer_id))
355+
.values()
356+
.filter_map(|query_state| query_state.attempts.get(peer_id))
357357
.any(|peer_rpc_state| matches!(peer_rpc_state, PeerRpcState::Init { .. }))
358358
}),
359359
TransitionFrontierSyncLedgerSnarkedAction::PeerQueryAddressError {

crates/p2p/src/network/identify/p2p_network_identify_protocol.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ impl<'a> TryFrom<&'a P2pNetworkIdentify> for super::pb::Identify {
151151
.iter()
152152
.map(|v| match v {
153153
StreamProtocolId::Known(k) => k.name_str().into(),
154-
StreamProtocolId::Unknown(s) => s.clone().into(),
154+
StreamProtocolId::Unknown(s) => s.clone(),
155155
})
156156
.collect(),
157157
})

0 commit comments

Comments
 (0)