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 --- src/audit_cleanup.rs | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'src/audit_cleanup.rs') diff --git a/src/audit_cleanup.rs b/src/audit_cleanup.rs index b976b1f..de78b1b 100644 --- a/src/audit_cleanup.rs +++ b/src/audit_cleanup.rs @@ -15,7 +15,7 @@ //! //! Runs every `AUDIT_CLEANUP_INTERVAL_SECS` seconds. -use std::path::PathBuf; +use std::path::{Path, PathBuf}; use std::time::Duration; use nostr_sdk::prelude::*; @@ -46,8 +46,12 @@ pub async fn run_audit_cleanup_loop(database: SharedDatabase, git_data_path: Pat } /// Perform a single cleanup pass. -async fn run_audit_cleanup_once(database: &SharedDatabase, git_data_path: &PathBuf) { - let cutoff = Timestamp::from(Timestamp::now().as_secs().saturating_sub(AUDIT_CLEANUP_AGE_SECS)); +async fn run_audit_cleanup_once(database: &SharedDatabase, git_data_path: &Path) { + let cutoff = Timestamp::from( + Timestamp::now() + .as_secs() + .saturating_sub(AUDIT_CLEANUP_AGE_SECS), + ); // --- Step 1: Find repo announcements to delete git repos for --- let repo_filter = Filter::new() @@ -73,10 +77,7 @@ async fn run_audit_cleanup_once(database: &SharedDatabase, git_data_path: &PathB if repo_path.exists() { match std::fs::remove_dir_all(&repo_path) { Ok(()) => { - debug!( - "audit_cleanup: deleted git repo {}", - repo_path.display() - ); + debug!("audit_cleanup: deleted git repo {}", repo_path.display()); repos_deleted += 1; // Remove the parent npub directory if it is now empty @@ -131,9 +132,7 @@ async fn run_audit_cleanup_once(database: &SharedDatabase, git_data_path: &PathB } // --- Step 2: Delete all audit events from the database --- - let all_audit_filter = Filter::new() - .hashtag(AUDIT_TEST_EVENT_TAG) - .until(cutoff); + let all_audit_filter = Filter::new().hashtag(AUDIT_TEST_EVENT_TAG).until(cutoff); match database.delete(all_audit_filter).await { Ok(()) => { @@ -143,7 +142,10 @@ async fn run_audit_cleanup_once(database: &SharedDatabase, git_data_path: &PathB ); } Err(e) => { - error!("audit_cleanup: failed to delete audit events from database: {}", e); + error!( + "audit_cleanup: failed to delete audit events from database: {}", + e + ); } } } -- cgit v1.2.3