chore: derive default for enums
This commit is contained in:
parent
c2d7b8321f
commit
27761d7acc
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue