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 --- grasp-audit/src/specs/grasp01/nip01_smoke.rs | 32 ++++++++++++++++------------ 1 file changed, 18 insertions(+), 14 deletions(-) (limited to 'grasp-audit/src/specs/grasp01/nip01_smoke.rs') diff --git a/grasp-audit/src/specs/grasp01/nip01_smoke.rs b/grasp-audit/src/specs/grasp01/nip01_smoke.rs index 8a0a4d1..4dbcd3d 100644 --- a/grasp-audit/src/specs/grasp01/nip01_smoke.rs +++ b/grasp-audit/src/specs/grasp01/nip01_smoke.rs @@ -163,23 +163,27 @@ impl Nip01SmokeTests { /// Spec: NIP-01 CLOSE message /// Requirement: Relay MUST support CLOSE to end subscriptions pub async fn test_close_subscription(client: &AuditClient) -> TestResult { - TestResult::new("close_subscription", "GRASP-01:nostr-relay:7", "Can close subscriptions") - .run(|| async { - // For now, we just verify we can query events - // Full subscription management with CLOSE would require - // lower-level WebSocket access + TestResult::new( + "close_subscription", + "GRASP-01:nostr-relay:7", + "Can close subscriptions", + ) + .run(|| async { + // For now, we just verify we can query events + // Full subscription management with CLOSE would require + // lower-level WebSocket access - let filter = Filter::new().kind(Kind::TextNote).limit(1); + let filter = Filter::new().kind(Kind::TextNote).limit(1); - let _events = client - .subscribe(vec![filter], Some(std::time::Duration::from_secs(2))) - .await - .map_err(|e| format!("Failed to subscribe: {}", e))?; + let _events = client + .subscribe(vec![filter], Some(std::time::Duration::from_secs(2))) + .await + .map_err(|e| format!("Failed to subscribe: {}", e))?; - // If we got here, subscription worked - Ok(()) - }) - .await + // If we got here, subscription worked + Ok(()) + }) + .await } /// Test 5: Rejects events with invalid signatures -- cgit v1.2.3