Skip to content

Commit 99aee57

Browse files
committed
fix clippy
1 parent 1efa950 commit 99aee57

File tree

12 files changed

+20
-17
lines changed

12 files changed

+20
-17
lines changed

rust/cardano-chain-follower/src/chain_sync_config.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,9 @@ impl ChainSyncConfig {
133133
stats::sync_started(self.chain);
134134

135135
// Start the Chain Sync - IFF its not already running.
136-
let lock_entry = match SYNC_JOIN_HANDLE_MAP.get(&self.chain) {
137-
None => {
138-
error!("Join Map improperly initialized: Missing {}!!", self.chain);
139-
return Err(Error::Internal); // Should not get here.
140-
},
141-
Some(entry) => entry,
136+
let Some(lock_entry) = SYNC_JOIN_HANDLE_MAP.get(&self.chain) else {
137+
error!("Join Map improperly initialized: Missing {}!!", self.chain);
138+
return Err(Error::Internal); // Should not get here.
142139
};
143140
let mut locked_handle = lock_entry.value().lock().await;
144141

rust/cardano-chain-follower/src/mithril_snapshot_config.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -392,12 +392,9 @@ impl MithrilSnapshotConfig {
392392
);
393393

394394
// Start the Mithril Sync - IFF its not already running.
395-
let lock_entry = match SYNC_JOIN_HANDLE_MAP.get(&self.chain) {
396-
None => {
397-
error!("Join Map improperly initialized: Missing {}!!", self.chain);
398-
return Err(Error::Internal); // Should not get here.
399-
},
400-
Some(entry) => entry,
395+
let Some(lock_entry) = SYNC_JOIN_HANDLE_MAP.get(&self.chain) else {
396+
error!("Join Map improperly initialized: Missing {}!!", self.chain);
397+
return Err(Error::Internal); // Should not get here.
401398
};
402399
let mut locked_handle = lock_entry.value().lock().await;
403400

@@ -448,9 +445,8 @@ fn check_writable(path: &Path) -> bool {
448445
}
449446

450447
// Can't read the directory for any reason, so can't write to the directory.
451-
let path_iterator = match path.read_dir() {
452-
Err(_) => return false,
453-
Ok(entries) => entries,
448+
let Ok(path_iterator) = path.read_dir() else {
449+
return false;
454450
};
455451

456452
// Recursively check the contents of the directory

rust/catalyst-voting/benches/vote_protocol.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
missing_docs,
99
clippy::missing_docs_in_private_items,
1010
clippy::unwrap_used,
11-
clippy::similar_names
11+
clippy::similar_names,
12+
clippy::explicit_deref_methods
1213
)]
1314

1415
use catalyst_voting::{

rust/catalyst-voting/src/crypto/babystep_giantstep.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ impl BabyStepGiantStep {
9595
}
9696

9797
#[cfg(test)]
98+
#[allow(clippy::explicit_deref_methods)]
9899
mod tests {
99100
use std::ops::Mul;
100101

rust/catalyst-voting/src/crypto/zk_unit_vector/decoding.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ impl ResponseRandomness {
152152
}
153153

154154
#[cfg(test)]
155+
#[allow(clippy::explicit_deref_methods)]
155156
mod tests {
156157
use test_strategy::proptest;
157158

rust/catalyst-voting/src/crypto/zk_unit_vector/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ mod arbitrary_impl {
264264
}
265265

266266
#[cfg(test)]
267+
#[allow(clippy::explicit_deref_methods)]
267268
mod tests {
268269
use proptest::sample::size_range;
269270
use rand_core::OsRng;

rust/catalyst-voting/src/vote_protocol/voter/decoding.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ impl VoterProof {
7878
}
7979

8080
#[cfg(test)]
81+
#[allow(clippy::explicit_deref_methods)]
8182
mod tests {
8283
use std::io::Cursor;
8384

rust/catalyst-voting/tests/voting_test.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//! A general voting integration test, which performs a full voting procedure.
22
3+
#![allow(clippy::explicit_deref_methods)]
4+
35
use catalyst_voting::vote_protocol::{
46
committee::ElectionSecretKey,
57
tally::{

rust/rbac-registration/src/cardano/cip509/validation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ pub fn validate_stake_public_key(
119119
let context = "Cip509 stake public key validation";
120120

121121
let transaction = MultiEraTx::Conway(Box::new(Cow::Borrowed(transaction)));
122-
let witness = match TxnWitness::new(&[transaction.clone()]) {
122+
let witness = match TxnWitness::new(std::slice::from_ref(&transaction)) {
123123
Ok(w) => w,
124124
Err(e) => {
125125
report.other(&format!("Failed to create TxWitness: {e:?}"), context);

rust/vote-tx-v1/src/decoding.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ impl Tx {
216216
}
217217

218218
#[cfg(test)]
219+
#[allow(clippy::explicit_deref_methods)]
219220
mod tests {
220221
use catalyst_voting::{
221222
crypto::{ed25519::PrivateKey, rng::rand_core::OsRng},

0 commit comments

Comments
 (0)