diff --git a/ethers-core/src/types/block.rs b/ethers-core/src/types/block.rs index b4f81d1c..89b1dd69 100644 --- a/ethers-core/src/types/block.rs +++ b/ethers-core/src/types/block.rs @@ -531,9 +531,10 @@ impl<'de> Deserialize<'de> for BlockId { } /// A block Number (or tag - "latest", "earliest", "pending") -#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] +#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash)] pub enum BlockNumber { /// Latest block + #[default] Latest, /// Finalized block accepted as canonical Finalized, @@ -648,12 +649,6 @@ impl fmt::Display for BlockNumber { } } -impl Default for BlockNumber { - fn default() -> Self { - BlockNumber::Latest - } -} - #[cfg(test)] #[cfg(not(feature = "celo"))] mod tests { diff --git a/ethers-core/src/types/trace/filter.rs b/ethers-core/src/types/trace/filter.rs index eb36ac3a..c09b076f 100644 --- a/ethers-core/src/types/trace/filter.rs +++ b/ethers-core/src/types/trace/filter.rs @@ -112,7 +112,7 @@ pub struct Trace { } /// Response -#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)] +#[derive(Debug, Default, Clone, PartialEq, Eq, Deserialize, Serialize)] #[serde(untagged)] pub enum Res { /// Call @@ -120,15 +120,10 @@ pub enum Res { /// Create Create(CreateResult), /// None + #[default] None, } -impl Default for Res { - fn default() -> Res { - Res::None - } -} - /// Action #[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)] #[serde(untagged, rename_all = "lowercase")] @@ -198,9 +193,10 @@ pub struct Call { } /// Call type. -#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)] +#[derive(Debug, Default, Clone, PartialEq, Eq, Deserialize, Serialize)] pub enum CallType { /// None + #[default] #[serde(rename = "none")] None, /// Call @@ -217,12 +213,6 @@ pub enum CallType { StaticCall, } -impl Default for CallType { - fn default() -> CallType { - CallType::None - } -} - /// Create response #[derive(Debug, Clone, PartialEq, Eq, Default, Deserialize, Serialize)] pub struct Create {