Skip to content

Commit 644a299

Browse files
mattsselwedge99
authored andcommitted
chore: clippy happy (paradigmxyz#18310)
1 parent 2b36bdb commit 644a299

File tree

7 files changed

+16
-23
lines changed

7 files changed

+16
-23
lines changed

crates/optimism/consensus/src/proof.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ mod tests {
118118
];
119119

120120
for case in cases {
121-
let receipts = vec![
121+
let receipts = [
122122
// 0xb0d6ee650637911394396d81172bd1c637d568ed1fbddab0daddfca399c58b53
123123
OpReceipt::Deposit(OpDepositReceipt {
124124
inner: Receipt {

crates/payload/basic/src/lib.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -856,10 +856,12 @@ pub trait PayloadBuilder: Send + Sync + Clone {
856856
/// Tells the payload builder how to react to payload request if there's no payload available yet.
857857
///
858858
/// This situation can occur if the CL requests a payload before the first payload has been built.
859+
#[derive(Default)]
859860
pub enum MissingPayloadBehaviour<Payload> {
860861
/// Await the regular scheduled payload process.
861862
AwaitInProgress,
862863
/// Race the in progress payload process with an empty payload.
864+
#[default]
863865
RaceEmptyPayload,
864866
/// Race the in progress payload process with this job.
865867
RacePayload(Box<dyn FnOnce() -> Result<Payload, PayloadBuilderError> + Send>),
@@ -877,12 +879,6 @@ impl<Payload> fmt::Debug for MissingPayloadBehaviour<Payload> {
877879
}
878880
}
879881

880-
impl<Payload> Default for MissingPayloadBehaviour<Payload> {
881-
fn default() -> Self {
882-
Self::RaceEmptyPayload
883-
}
884-
}
885-
886882
/// Checks if the new payload is better than the current best.
887883
///
888884
/// This compares the total fees of the blocks, higher is better.

crates/prune/types/src/mode.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ pub enum PruneMode {
1818
}
1919

2020
#[cfg(any(test, feature = "test-utils"))]
21+
#[allow(clippy::derivable_impls)]
2122
impl Default for PruneMode {
2223
fn default() -> Self {
2324
Self::Full

crates/prune/types/src/segment.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ pub enum PruneSegment {
2828
Transactions,
2929
}
3030

31+
#[cfg(test)]
32+
#[allow(clippy::derivable_impls)]
33+
impl Default for PruneSegment {
34+
fn default() -> Self {
35+
Self::SenderRecovery
36+
}
37+
}
38+
3139
impl PruneSegment {
3240
/// Returns minimum number of blocks to keep in the database for this segment.
3341
pub const fn min_blocks(&self, purpose: PrunePurpose) -> u64 {
@@ -82,10 +90,3 @@ pub enum PruneSegmentError {
8290
#[error("the configuration provided for {0} is invalid")]
8391
Configuration(PruneSegment),
8492
}
85-
86-
#[cfg(test)]
87-
impl Default for PruneSegment {
88-
fn default() -> Self {
89-
Self::SenderRecovery
90-
}
91-
}

crates/storage/libmdbx-rs/src/flags.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ use bitflags::bitflags;
22
use ffi::*;
33

44
/// MDBX sync mode
5-
#[derive(Clone, Copy, Debug)]
5+
#[derive(Clone, Copy, Debug, Default)]
66
pub enum SyncMode {
77
/// Default robust and durable sync mode.
88
/// Metadata is written and flushed to disk after a data is written and flushed, which
99
/// guarantees the integrity of the database in the event of a crash at any time.
10+
#[default]
1011
Durable,
1112

1213
/// Don't sync the meta-page after commit.
@@ -100,12 +101,6 @@ pub enum SyncMode {
100101
UtterlyNoSync,
101102
}
102103

103-
impl Default for SyncMode {
104-
fn default() -> Self {
105-
Self::Durable
106-
}
107-
}
108-
109104
#[derive(Clone, Copy, Debug)]
110105
pub enum Mode {
111106
ReadOnly,

crates/transaction-pool/src/pool/pending.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ mod tests {
748748

749749
// the independent set is the roots of each of these tx chains, these are the highest
750750
// nonces for each sender
751-
let expected_highest_nonces = vec![d[0].clone(), c[2].clone(), b[2].clone(), a[3].clone()]
751+
let expected_highest_nonces = [d[0].clone(), c[2].clone(), b[2].clone(), a[3].clone()]
752752
.iter()
753753
.map(|tx| (tx.sender(), tx.nonce()))
754754
.collect::<HashSet<_>>();

crates/trie/sparse-parallel/src/trie.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5687,7 +5687,7 @@ mod tests {
56875687
// 0xXY: Leaf { key: 0xZ... }
56885688

56895689
// Create leaves that will force multiple subtries
5690-
let leaves = vec![
5690+
let leaves = [
56915691
ctx.create_test_leaf([0x0, 0x0, 0x1, 0x2], 1),
56925692
ctx.create_test_leaf([0x0, 0x1, 0x3, 0x4], 2),
56935693
ctx.create_test_leaf([0x0, 0x2, 0x5, 0x6], 3),

0 commit comments

Comments
 (0)