Skip to content

Commit 61bbb3a

Browse files
committed
replace SyncPhase matches wildcard usage with exhaustive match
1 parent 1439955 commit 61bbb3a

File tree

2 files changed

+32
-6
lines changed

2 files changed

+32
-6
lines changed

dash-spv/src/sync/phase_execution.rs

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,11 @@ impl<
185185
self.transition_to_next_phase(storage, network, "No blocks to download").await?;
186186
}
187187

188-
_ => {
189-
// Idle or FullySynced - nothing to execute
188+
SyncPhase::Idle
189+
| SyncPhase::FullySynced {
190+
..
191+
} => {
192+
// Nothing to execute
190193
}
191194
}
192195

@@ -422,7 +425,15 @@ impl<
422425
}
423426
}
424427
}
425-
_ => {}
428+
SyncPhase::Idle
429+
| SyncPhase::FullySynced {
430+
..
431+
}
432+
| SyncPhase::DownloadingBlocks {
433+
..
434+
} => {
435+
// Nothing to execute
436+
}
426437
}
427438

428439
Ok(())
@@ -467,7 +478,16 @@ impl<
467478
} => {
468479
self.filter_sync.check_cfheader_request_timeouts(network, storage).await?;
469480
}
470-
_ => {
481+
SyncPhase::Idle
482+
| SyncPhase::DownloadingFilters {
483+
..
484+
}
485+
| SyncPhase::DownloadingBlocks {
486+
..
487+
}
488+
| SyncPhase::FullySynced {
489+
..
490+
} => {
471491
// For other phases, we'll need phase-specific recovery
472492
}
473493
}

dash-spv/src/sync/phases.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,10 @@ impl SyncPhase {
170170
last_progress,
171171
..
172172
} => Some(*last_progress),
173-
_ => None,
173+
SyncPhase::Idle
174+
| SyncPhase::FullySynced {
175+
..
176+
} => None,
174177
}
175178
}
176179

@@ -198,7 +201,10 @@ impl SyncPhase {
198201
last_progress,
199202
..
200203
} => *last_progress = now,
201-
_ => {}
204+
SyncPhase::Idle
205+
| SyncPhase::FullySynced {
206+
..
207+
} => {}
202208
}
203209
}
204210
}

0 commit comments

Comments
 (0)