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/metrics/bandwidth.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/metrics/bandwidth.rs') diff --git a/src/metrics/bandwidth.rs b/src/metrics/bandwidth.rs index d2c53e8..d51af12 100644 --- a/src/metrics/bandwidth.rs +++ b/src/metrics/bandwidth.rs @@ -80,7 +80,9 @@ impl BandwidthTracker { &["repo"], ) .unwrap(); - registry.register(Box::new(top_repos_gauge.clone())).unwrap(); + registry + .register(Box::new(top_repos_gauge.clone())) + .unwrap(); Self { all_repos: DashMap::new(), @@ -120,7 +122,12 @@ impl BandwidthTracker { // Try to update the timestamp atomically to prevent concurrent refreshes if self .last_refresh_nanos - .compare_exchange(last_refresh, elapsed_nanos, Ordering::SeqCst, Ordering::Relaxed) + .compare_exchange( + last_refresh, + elapsed_nanos, + Ordering::SeqCst, + Ordering::Relaxed, + ) .is_ok() { self.refresh_top_n(); @@ -298,4 +305,4 @@ mod tests { // Refresh should not panic on empty data tracker.refresh_top_n(); } -} \ No newline at end of file +} -- cgit v1.2.3