Skip to content

Commit ceb77e5

Browse files
committed
core/src/network: Use custom method on DialAttemptsRemaining
1 parent cef949c commit ceb77e5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

core/src/network/event.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,9 @@ pub enum DialAttemptsRemaining<THandler> {
178178
None(THandler),
179179
}
180180

181-
impl<THandler> From<&DialAttemptsRemaining<THandler>> for u32 {
182-
fn from(attempts_remaining: &DialAttemptsRemaining<THandler>) -> Self {
183-
match attempts_remaining {
181+
impl<THandler> DialAttemptsRemaining<THandler> {
182+
fn get_attempts(&self) -> u32 {
183+
match self {
184184
DialAttemptsRemaining::Some(attempts) => (*attempts).into(),
185185
DialAttemptsRemaining::None(_) => 0,
186186
}
@@ -268,7 +268,7 @@ where
268268
error,
269269
} => f
270270
.debug_struct("DialError")
271-
.field("attempts_remaining", &Into::<u32>::into(attempts_remaining))
271+
.field("attempts_remaining", &attempts_remaining.get_attempts())
272272
.field("peer_id", peer_id)
273273
.field("multiaddr", multiaddr)
274274
.field("error", error)

0 commit comments

Comments
 (0)