From 9d86cf15f0275ffeee4519bd054e3b61dc8992ac Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Thu, 26 Feb 2026 15:42:09 +0000 Subject: chore: apply cargo fmt and fix clippy warnings Fix pre-existing clippy lints: - &PathBuf -> &Path in audit_cleanup.rs - too_many_arguments on process_newly_available_git_data, process_purgatory_announcements, and HttpService::new - clone_on_copy for PublicKey (Copy type) in purgatory cleanup loop --- tests/common/sync_helpers.rs | 7 +++++-- tests/purgatory_persistence.rs | 10 ++++++++-- tests/purgatory_sync.rs | 15 +++++---------- tests/sync/discovery.rs | 6 ++++-- tests/sync/maintainer_reprocessing.rs | 25 ++++++++++++++----------- tests/sync/metrics.rs | 19 ++++++++++++++----- 6 files changed, 50 insertions(+), 32 deletions(-) (limited to 'tests') diff --git a/tests/common/sync_helpers.rs b/tests/common/sync_helpers.rs index af51e78..611b1a5 100644 --- a/tests/common/sync_helpers.rs +++ b/tests/common/sync_helpers.rs @@ -1240,8 +1240,11 @@ pub async fn push_unique_git_data_to_relay( git(path, &["config", "commit.gpgsign", "false"]); // Write a unique file so each maintainer gets a distinct commit hash - std::fs::write(path.join("state_test.txt"), "State test content for purgatory sync") - .expect("write state_test.txt"); + std::fs::write( + path.join("state_test.txt"), + "State test content for purgatory sync", + ) + .expect("write state_test.txt"); std::fs::write(path.join(".unique"), unique_seed).expect("write .unique"); git(path, &["add", "."]); git(path, &["commit", "-m", "State test commit"]); diff --git a/tests/purgatory_persistence.rs b/tests/purgatory_persistence.rs index 655b0d9..0c1de28 100644 --- a/tests/purgatory_persistence.rs +++ b/tests/purgatory_persistence.rs @@ -169,7 +169,10 @@ async fn test_full_purgatory_save_restore_cycle() { // Verify all data was restored let (announcement_count2, state_count2, pr_count2) = purgatory2.count(); - assert_eq!(announcement_count2, 1, "Should have 1 announcement after restore"); + assert_eq!( + announcement_count2, 1, + "Should have 1 announcement after restore" + ); assert_eq!(state_count2, 2, "Should have 2 state events after restore"); assert_eq!( pr_count2, 3, @@ -853,7 +856,10 @@ async fn test_announcement_save_restore_cycle() { let purgatory2 = Purgatory::new(&git_data_path); purgatory2.restore_from_disk(&state_path).unwrap(); - assert!(!state_path.exists(), "State file should be deleted after restore"); + assert!( + !state_path.exists(), + "State file should be deleted after restore" + ); let (ann_count2, _, _) = purgatory2.count(); assert_eq!(ann_count2, 1, "Announcement should be restored"); diff --git a/tests/purgatory_sync.rs b/tests/purgatory_sync.rs index eefd6bc..ced39ff 100644 --- a/tests/purgatory_sync.rs +++ b/tests/purgatory_sync.rs @@ -711,15 +711,10 @@ async fn test_concurrent_state_and_pr_sync() { ); // Check refs/nostr/ points to pr_commit - let pr_ref_correct = check_ref_at_commit( - &syncing_domain, - &npub, - identifier, - &pr_ref_name, - &pr_commit, - ) - .await - .expect("Failed to check PR ref"); + let pr_ref_correct = + check_ref_at_commit(&syncing_domain, &npub, identifier, &pr_ref_name, &pr_commit) + .await + .expect("Failed to check PR ref"); assert!( pr_ref_correct, @@ -993,7 +988,7 @@ async fn test_pr_event_clone_tag_sync_with_partial_oid_aggregation_from_multiple let syncing_relay = TestRelay::start_on_port_with_options( syncing_port, Some(source_grasp.url().to_string()), // Bootstrap from source_grasp - true, // Disable negentropy - MockRelay doesn't support NIP-77 + true, // Disable negentropy - MockRelay doesn't support NIP-77 ) .await; diff --git a/tests/sync/discovery.rs b/tests/sync/discovery.rs index d45a290..ee675e6 100644 --- a/tests/sync/discovery.rs +++ b/tests/sync/discovery.rs @@ -183,7 +183,10 @@ async fn test_relay_discovery_via_announcements_with_historic_sync() { let (announcement, _git_dir_a) = setup_announcement_on_relay(&relay_a, &keys, &domain_refs, repo_id).await; let announcement_id = announcement.id; - println!("Announcement {} set up on relay_a with git data (Layer 1)", announcement_id); + println!( + "Announcement {} set up on relay_a with git data (Layer 1)", + announcement_id + ); // Build repo coordinate for Layer 2 reference let repo_coord = repo_coord(&keys, repo_id); @@ -235,4 +238,3 @@ async fn test_relay_discovery_via_announcements_with_historic_sync() { issue_id ); } - diff --git a/tests/sync/maintainer_reprocessing.rs b/tests/sync/maintainer_reprocessing.rs index ff1eb43..9154ee5 100644 --- a/tests/sync/maintainer_reprocessing.rs +++ b/tests/sync/maintainer_reprocessing.rs @@ -70,17 +70,15 @@ async fn test_maintainer_announcement_reprocessed_immediately() { identifier )], ), - Tag::custom( - TagKind::custom("relays"), - vec![relay_a.url().to_string()], - ), + Tag::custom(TagKind::custom("relays"), vec![relay_a.url().to_string()]), ]) .sign_with_keys(&maintainer_keys) .unwrap(); - send_to_relay(&relay_a, &maintainer_announcement).await.unwrap(); + send_to_relay(&relay_a, &maintainer_announcement) + .await + .unwrap(); let _git_dir_maintainer = - push_git_data_to_relay(&relay_a, &maintainer_keys, identifier, &[&relay_a.domain()]) - .await; + push_git_data_to_relay(&relay_a, &maintainer_keys, identifier, &[&relay_a.domain()]).await; println!("✓ Maintainer announcement + git data pushed to relay_a"); // Step 2: Start relay_b with relay_a as bootstrap so its SyncManager connects immediately. @@ -134,7 +132,9 @@ async fn test_maintainer_announcement_reprocessed_immediately() { // re-processing of the maintainer announcement via our new code path. let _git_dir_owner = push_git_data_to_relay(&relay_b, &owner_keys, identifier, &[&relay_b.domain()]).await; - println!("✓ Owner git data pushed to relay_b (owner announcement promoted, hot cache re-processed)"); + println!( + "✓ Owner git data pushed to relay_b (owner announcement promoted, hot cache re-processed)" + ); // Step 5: Wait briefly for async processing to complete. tokio::time::sleep(Duration::from_secs(1)).await; @@ -363,9 +363,12 @@ async fn test_multiple_maintainers_all_reprocessed() { .kind(Kind::GitRepoAnnouncement) .author(keys.public_key()) .identifier(identifier); - let found = - wait_for_event_on_relay(relay_a.url(), filter, Duration::from_secs(10)).await; - assert!(found, "{} announcement should be in relay_a before starting relay_b", name); + let found = wait_for_event_on_relay(relay_a.url(), filter, Duration::from_secs(10)).await; + assert!( + found, + "{} announcement should be in relay_a before starting relay_b", + name + ); } println!("✓ All three maintainer announcements confirmed in relay_a's DB"); diff --git a/tests/sync/metrics.rs b/tests/sync/metrics.rs index e973bbb..996c8b7 100644 --- a/tests/sync/metrics.rs +++ b/tests/sync/metrics.rs @@ -417,9 +417,12 @@ async fn test_live_sync_event_count() { println!("Announcement set up on source relay with git data"); // Start syncing relay with pre-allocated port - let syncing_relay = - TestRelay::start_on_port_with_options(sync_port, Some(source_relay.url().to_string()), false) - .await; + let syncing_relay = TestRelay::start_on_port_with_options( + sync_port, + Some(source_relay.url().to_string()), + false, + ) + .await; println!("Syncing relay started at {}", syncing_relay.url()); // Wait for sync connection to be fully established with EOSE received @@ -458,8 +461,14 @@ async fn test_live_sync_event_count() { let client = TestClient::new(source_relay.url(), keys.clone()) .await .expect("Failed to connect to source"); - client.send_event(&patch1).await.expect("Failed to send patch 1"); - client.send_event(&patch2).await.expect("Failed to send patch 2"); + client + .send_event(&patch1) + .await + .expect("Failed to send patch 1"); + client + .send_event(&patch2) + .await + .expect("Failed to send patch 2"); client.disconnect().await; println!("Two patches sent to source relay (live mode)"); -- cgit v1.2.3