Skip to content

Commit f1c1f13

Browse files
committed
refactor(ibc-apps): remove TracePath::default()
1 parent 48656b7 commit f1c1f13

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

ibc-apps/ics20-transfer/types/src/denom.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ impl Display for TracePrefix {
109109
)]
110110
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
111111
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
112-
#[derive(Clone, Debug, Default, Eq, PartialEq, PartialOrd, Ord, From)]
112+
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord, From)]
113113
pub struct TracePath(Vec<TracePrefix>);
114114

115115
impl TracePath {
@@ -134,6 +134,11 @@ impl TracePath {
134134
pub fn is_empty(&self) -> bool {
135135
self.0.is_empty()
136136
}
137+
138+
/// Return empty trace path
139+
pub fn empty() -> Self {
140+
Self(vec![])
141+
}
137142
}
138143

139144
impl<'a> TryFrom<Vec<&'a str>> for TracePath {
@@ -294,7 +299,7 @@ impl FromStr for PrefixedDenom {
294299

295300
let (base_denom, trace_path) = {
296301
if last_part == s {
297-
(BaseDenom::from_str(s)?, TracePath::default())
302+
(BaseDenom::from_str(s)?, TracePath::empty())
298303
} else {
299304
let base_denom = BaseDenom::from_str(last_part)?;
300305
let trace_path = TracePath::try_from(parts)?;
@@ -334,7 +339,7 @@ impl From<PrefixedDenom> for RawDenomTrace {
334339
impl From<BaseDenom> for PrefixedDenom {
335340
fn from(denom: BaseDenom) -> Self {
336341
Self {
337-
trace_path: Default::default(),
342+
trace_path: TracePath::empty(),
338343
base_denom: denom,
339344
}
340345
}

ibc-apps/ics721-nft-transfer/types/src/class.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ impl Display for TracePrefix {
106106
)]
107107
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
108108
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
109-
#[derive(Clone, Debug, Default, Eq, PartialEq, PartialOrd, Ord, From)]
109+
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord, From)]
110110
pub struct TracePath(Vec<TracePrefix>);
111111

112112
impl TracePath {
@@ -131,6 +131,11 @@ impl TracePath {
131131
pub fn is_empty(&self) -> bool {
132132
self.0.is_empty()
133133
}
134+
135+
/// Return empty trace path
136+
pub fn empty() -> Self {
137+
Self(vec![])
138+
}
134139
}
135140

136141
impl<'a> TryFrom<Vec<&'a str>> for TracePath {
@@ -268,7 +273,7 @@ impl FromStr for PrefixedClassId {
268273

269274
let (base_class_id, trace_path) = {
270275
if last_part == s {
271-
(ClassId::from_str(s)?, TracePath::default())
276+
(ClassId::from_str(s)?, TracePath::empty())
272277
} else {
273278
let base_class_id = ClassId::from_str(last_part)?;
274279
let trace_path = TracePath::try_from(parts)?;
@@ -308,7 +313,7 @@ impl From<PrefixedClassId> for RawClassTrace {
308313
impl From<ClassId> for PrefixedClassId {
309314
fn from(class_id: ClassId) -> Self {
310315
Self {
311-
trace_path: Default::default(),
316+
trace_path: TracePath::empty(),
312317
base_class_id: class_id,
313318
}
314319
}

ibc-apps/ics721-nft-transfer/types/src/data.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use crate::error::NftTransferError;
2424
derive(borsh::BorshSerialize, borsh::BorshDeserialize)
2525
)]
2626
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
27-
#[derive(Clone, Debug, Default, PartialEq, Eq, derive_more::From)]
27+
#[derive(Clone, Debug, PartialEq, Eq, derive_more::From)]
2828
pub struct Data(String);
2929

3030
#[cfg(feature = "serde")]
@@ -88,7 +88,7 @@ impl<'de> serde::Deserialize<'de> for Data {
8888
)]
8989
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
9090
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
91-
#[derive(Clone, Debug, Default, PartialEq, Eq)]
91+
#[derive(Clone, Debug, PartialEq, Eq)]
9292
pub struct Ics721Data(BTreeMap<String, DataValue>);
9393

9494
#[cfg(feature = "serde")]
@@ -100,7 +100,7 @@ impl FromStr for Ics721Data {
100100
}
101101
}
102102

103-
#[derive(Clone, Debug, Default, PartialEq, Eq)]
103+
#[derive(Clone, Debug, PartialEq, Eq)]
104104
pub struct DataValue {
105105
value: String,
106106
mime: Option<Mime>,

0 commit comments

Comments
 (0)