From c9b2e08552642bbdb67255782307abf1e7eb78d0 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Tue, 2 Dec 2025 14:42:26 +0000 Subject: refactor: fix fmt and clippy --- grasp-audit/src/fixtures.rs | 6 +-- .../src/specs/grasp01/push_authorization.rs | 6 +-- src/http/mod.rs | 48 +++++++++++++--------- 3 files changed, 34 insertions(+), 26 deletions(-) diff --git a/grasp-audit/src/fixtures.rs b/grasp-audit/src/fixtures.rs index e48f6b9..e5a80d7 100644 --- a/grasp-audit/src/fixtures.rs +++ b/grasp-audit/src/fixtures.rs @@ -230,7 +230,7 @@ pub enum FixtureKind { /// /// Stages: /// 1. **Generated**: Creates ValidRepo (owner's announcement with maintainer in maintainers tag) - /// + MaintainerState (maintainer's state event ONLY - no announcement) + /// + MaintainerState (maintainer's state event ONLY - no announcement) /// 2. **Sent**: Sends events to relay /// 3. **Verified**: Confirms events accepted by relay /// 4. **DataPushed**: Clones repo, creates maintainer deterministic commit, pushes to relay @@ -253,8 +253,8 @@ pub enum FixtureKind { /// /// Stages: /// 1. **Generated**: Creates MaintainerStateDataPushed (includes ValidRepo + OwnerStateDataPushed) - /// + MaintainerAnnouncement (maintainer's announcement listing recursive maintainer) - /// + RecursiveMaintainerState (recursive maintainer's state event) + /// + MaintainerAnnouncement (maintainer's announcement listing recursive maintainer) + /// + RecursiveMaintainerState (recursive maintainer's state event) /// 2. **Sent**: Sends events to relay /// 3. **Verified**: Confirms events accepted by relay /// 4. **DataPushed**: Clones repo, creates recursive maintainer deterministic commit, pushes to relay diff --git a/grasp-audit/src/specs/grasp01/push_authorization.rs b/grasp-audit/src/specs/grasp01/push_authorization.rs index 00b8ae9..af6247f 100644 --- a/grasp-audit/src/specs/grasp01/push_authorization.rs +++ b/grasp-audit/src/specs/grasp01/push_authorization.rs @@ -650,7 +650,7 @@ impl PushAuthorizationTests { /// /// This test uses the MaintainerStateDataPushed fixture which handles all 4 stages: /// 1. **Generated**: Creates ValidRepo (owner's announcement with maintainer in maintainers tag) - /// + MaintainerState (maintainer's state event ONLY - no announcement) + /// + MaintainerState (maintainer's state event ONLY - no announcement) /// 2. **Sent**: Sends events to relay /// 3. **Verified**: Confirms events accepted by relay /// 4. **DataPushed**: Clones repo, creates maintainer deterministic commit, pushes to relay @@ -692,8 +692,8 @@ impl PushAuthorizationTests { /// /// This test uses the RecursiveMaintainerStateDataPushed fixture which handles all 4 stages: /// 1. **Generated**: Creates MaintainerStateDataPushed (owner's + maintainer's data pushed) - /// + MaintainerAnnouncement (maintainer lists recursive maintainer) - /// + RecursiveMaintainerState (recursive maintainer's state event) + /// + MaintainerAnnouncement (maintainer lists recursive maintainer) + /// + RecursiveMaintainerState (recursive maintainer's state event) /// 2. **Sent**: Sends events to relay /// 3. **Verified**: Confirms events accepted by relay /// 4. **DataPushed**: Clones repo, creates recursive maintainer deterministic commit, pushes to relay diff --git a/src/http/mod.rs b/src/http/mod.rs index 6da027c..c47c374 100644 --- a/src/http/mod.rs +++ b/src/http/mod.rs @@ -293,19 +293,23 @@ impl Service> for HttpService { if repo_path.exists() { // Serve repository webpage let html = landing::get_repo_html(&config, &npub, &identifier); - Ok(add_cors_headers(Response::builder().header("server", "ngit-grasp")) - .status(200) - .header("content-type", "text/html; charset=utf-8") - .body(Full::new(Bytes::from(html))) - .unwrap()) + Ok( + add_cors_headers(Response::builder().header("server", "ngit-grasp")) + .status(200) + .header("content-type", "text/html; charset=utf-8") + .body(Full::new(Bytes::from(html))) + .unwrap(), + ) } else { // Serve 404 page for non-existent repository let html = landing::get_404_html(&config, &npub, &identifier); - Ok(add_cors_headers(Response::builder().header("server", "ngit-grasp")) - .status(404) - .header("content-type", "text/html; charset=utf-8") - .body(Full::new(Bytes::from(html))) - .unwrap()) + Ok( + add_cors_headers(Response::builder().header("server", "ngit-grasp")) + .status(404) + .header("content-type", "text/html; charset=utf-8") + .body(Full::new(Bytes::from(html))) + .unwrap(), + ) } }); } @@ -361,19 +365,23 @@ impl Service> for HttpService { if path == "/" { // Serve landing page for root let html = landing::get_html(&config); - Ok(add_cors_headers(Response::builder().header("server", "ngit-grasp")) - .status(200) - .header("content-type", "text/html; charset=utf-8") - .body(Full::new(Bytes::from(html))) - .unwrap()) + Ok( + add_cors_headers(Response::builder().header("server", "ngit-grasp")) + .status(200) + .header("content-type", "text/html; charset=utf-8") + .body(Full::new(Bytes::from(html))) + .unwrap(), + ) } else { // Serve generic 404 for unknown paths let html = landing::get_generic_404_html(&config, &path); - Ok(add_cors_headers(Response::builder().header("server", "ngit-grasp")) - .status(404) - .header("content-type", "text/html; charset=utf-8") - .body(Full::new(Bytes::from(html))) - .unwrap()) + Ok( + add_cors_headers(Response::builder().header("server", "ngit-grasp")) + .status(404) + .header("content-type", "text/html; charset=utf-8") + .body(Full::new(Bytes::from(html))) + .unwrap(), + ) } }) } -- cgit v1.2.3