diff --git a/modules/src/clients/ics07_tendermint/client_def.rs b/modules/src/clients/ics07_tendermint/client_def.rs index 2eace19293..351ffffa2a 100644 --- a/modules/src/clients/ics07_tendermint/client_def.rs +++ b/modules/src/clients/ics07_tendermint/client_def.rs @@ -29,19 +29,11 @@ use crate::Height; use crate::downcast; -#[derive(Clone, Debug, PartialEq, Eq)] +#[derive(Clone, Debug, Default, PartialEq, Eq)] pub struct TendermintClient { verifier: ProdVerifier, } -impl Default for TendermintClient { - fn default() -> Self { - Self { - verifier: ProdVerifier::default(), - } - } -} - impl ClientDef for TendermintClient { type Header = Header; type ClientState = ClientState; diff --git a/modules/src/core/ics03_connection/connection.rs b/modules/src/core/ics03_connection/connection.rs index d03e22315e..5c379fe3f0 100644 --- a/modules/src/core/ics03_connection/connection.rs +++ b/modules/src/core/ics03_connection/connection.rs @@ -235,23 +235,13 @@ impl ConnectionEnd { } } -#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[derive(Clone, Debug, Default, PartialEq, Eq, Hash, Serialize, Deserialize)] pub struct Counterparty { client_id: ClientId, pub connection_id: Option, prefix: CommitmentPrefix, } -impl Default for Counterparty { - fn default() -> Self { - Counterparty { - client_id: Default::default(), - connection_id: None, - prefix: Default::default(), - } - } -} - impl Protobuf for Counterparty {} // Converts from the wire format RawCounterparty. Typically used from the relayer side diff --git a/modules/src/core/ics03_connection/events.rs b/modules/src/core/ics03_connection/events.rs index a3a8b73b5e..1ab4dbdcd3 100644 --- a/modules/src/core/ics03_connection/events.rs +++ b/modules/src/core/ics03_connection/events.rs @@ -71,7 +71,7 @@ fn extract_attributes_from_tx(event: &tendermint::abci::Event) -> Result, @@ -80,18 +80,6 @@ pub struct Attributes { pub counterparty_client_id: ClientId, } -impl Default for Attributes { - fn default() -> Self { - Attributes { - height: Default::default(), - connection_id: Default::default(), - client_id: Default::default(), - counterparty_connection_id: Default::default(), - counterparty_client_id: Default::default(), - } - } -} - /// Convert attributes to Tendermint ABCI tags /// /// # Note diff --git a/modules/src/core/ics04_channel/channel.rs b/modules/src/core/ics04_channel/channel.rs index 15e0ad946a..2965a08153 100644 --- a/modules/src/core/ics04_channel/channel.rs +++ b/modules/src/core/ics04_channel/channel.rs @@ -244,21 +244,12 @@ impl ChannelEnd { } } -#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] +#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)] pub struct Counterparty { pub port_id: PortId, pub channel_id: Option, } -impl Default for Counterparty { - fn default() -> Self { - Counterparty { - port_id: Default::default(), - channel_id: None, - } - } -} - impl Counterparty { pub fn new(port_id: PortId, channel_id: Option) -> Self { Self { diff --git a/modules/src/core/ics04_channel/events.rs b/modules/src/core/ics04_channel/events.rs index 8483df271f..972794c8a8 100644 --- a/modules/src/core/ics04_channel/events.rs +++ b/modules/src/core/ics04_channel/events.rs @@ -180,7 +180,7 @@ fn extract_packet_and_write_ack_from_tx( Ok((packet, write_ack)) } -#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[derive(Debug, Default, Deserialize, Serialize, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct Attributes { pub height: Height, pub port_id: PortId, @@ -199,19 +199,6 @@ impl Attributes { } } -impl Default for Attributes { - fn default() -> Self { - Attributes { - height: Default::default(), - port_id: Default::default(), - channel_id: Default::default(), - connection_id: Default::default(), - counterparty_port_id: Default::default(), - counterparty_channel_id: Default::default(), - } - } -} - /// Convert attributes to Tendermint ABCI tags /// /// # Note diff --git a/modules/src/core/ics04_channel/packet.rs b/modules/src/core/ics04_channel/packet.rs index 8273cedb01..12ec013549 100644 --- a/modules/src/core/ics04_channel/packet.rs +++ b/modules/src/core/ics04_channel/packet.rs @@ -54,15 +54,11 @@ impl core::fmt::Display for PacketMsgType { } /// The sequence number of a packet enforces ordering among packets from the same source. -#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Deserialize, Serialize, PartialOrd, Ord)] +#[derive( + Copy, Clone, Debug, Default, PartialEq, Eq, Hash, PartialOrd, Ord, Deserialize, Serialize, +)] pub struct Sequence(u64); -impl Default for Sequence { - fn default() -> Self { - Sequence(0) - } -} - impl FromStr for Sequence { type Err = Error; diff --git a/modules/src/timestamp.rs b/modules/src/timestamp.rs index ece5c63e67..500ea37377 100644 --- a/modules/src/timestamp.rs +++ b/modules/src/timestamp.rs @@ -20,7 +20,7 @@ pub const ZERO_DURATION: Duration = Duration::from_secs(0); /// a `u64` value and a raw timestamp. In protocol buffer, the timestamp is /// represented as a `u64` Unix timestamp in nanoseconds, with 0 representing the absence /// of timestamp. -#[derive(PartialEq, Eq, Copy, Clone, Debug, Deserialize, Serialize, Hash)] +#[derive(PartialEq, Eq, Copy, Clone, Debug, Default, Deserialize, Serialize, Hash)] pub struct Timestamp { time: Option>, } @@ -241,12 +241,6 @@ impl From