From 2a9160836bb87fdea3ae891563b0169c68d1c2ab Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Thu, 11 Dec 2025 16:53:03 +0000 Subject: fix: resolve all fmt and clippy warnings Main lib (src/): - Add #[allow(dead_code)] for build_info field (stored to prevent Prometheus unregistration) - Add #[allow(dead_code)] for first_seen field (reserved for future rate limiting) - Replace .or_insert_with(RelaySyncNeeds::default) with .or_default() - Replace manual div_ceil implementations with .div_ceil(100) Test code (tests/): - Replace .expect(&format!(...)) with .unwrap_or_else(|_| panic!(...)) - Remove needless borrows in fetch_metrics() calls - Add #[allow(dead_code)] and #[allow(unused_imports)] to test helpers module grasp-audit: - Apply cargo fmt to fix formatting --- src/sync/metrics.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/sync/metrics.rs') diff --git a/src/sync/metrics.rs b/src/sync/metrics.rs index 411ff63..d917dc0 100644 --- a/src/sync/metrics.rs +++ b/src/sync/metrics.rs @@ -207,7 +207,9 @@ impl SyncMetrics { HealthState::Degraded => 2, HealthState::Dead => 3, }; - self.relay_status.with_label_values(&[relay]).set(state_value); + self.relay_status + .with_label_values(&[relay]) + .set(state_value); } /// Record relay failure count. @@ -259,9 +261,7 @@ impl SyncMetrics { /// * `source` - The event source type (see [`record_event`](Self::record_event)) /// * `count` - Number of events to record pub fn record_events(&self, source: &str, count: u64) { - self.events_total - .with_label_values(&[source]) - .inc_by(count); + self.events_total.with_label_values(&[source]).inc_by(count); } /// Record a gap event filled during catchup. @@ -451,4 +451,4 @@ mod tests { let metrics2 = SyncMetrics::register(®istry); assert!(metrics2.is_err()); } -} \ No newline at end of file +} -- cgit v1.2.3