From 6c4b4394bd8ddf28d130e87e0100349f13f6e912 Mon Sep 17 00:00:00 2001 From: dev Date: Fri, 20 Nov 2026 18:49:22 +0000 Subject: foundation, http: export what is used above you, and nothing else MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The leaf modules were the widest liars. `git` exported 19 names of which 5 were named by nobody; `hash` exported a constant `EMPTY` that no code had ever referenced; `time` exported a virtual clock, an `advance` and a `wrap` whose only caller was a test that turned out not to exist. A leaf's interface is the whole contract the rest of the crate can rely on, and these interfaces were mostly decoration. Nine items were genuinely dead and are gone: `hash::EMPTY`, `git::{clone_source, count_commits, log_oneline, ls_remote_heads}`, `recipe::is_diffable`, `pkginfo::values_of`, `time::virtual_now`, and a free `time::advance` that had been shadowed by the `VirtualClock` method tests actually call. Eighteen more were used only inside their own module and are now private — `fetch`'s `Body` aside, which is the return type of a public parser and so is part of the interface whether or not anyone writes its name. http went 68 exported names to 27, and its last two glob re-exports (`pub(crate) use mutations::*; use pages::*;`) are explicit lists now. That makes the crate's glob count zero, so the allowlist in the architecture test is empty and can stay that way. Narrowing surfaced dead code that `pub` had been hiding, because a public item is presumed used and never questioned: `Req::query` and `Req::body` were parsed and stored and never read, `Res::found` had no callers, and `sse::FileBody` was a reader nobody constructed. All four are deleted rather than re-published to keep the warning quiet. git 19→14, hash 8→7, recipe 11→7, urlutil 2→1, config 35→31, pkgver 18→14, time 16→14, pkginfo 7→6, http 68→27. Crate totals: 585→516 pub, 219→115 dead, 4→0 globs. 281 passed / 0 failed, clippy -D warnings clean, release build clean, architecture 8/8. --- src/http/render.rs | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'src/http/render.rs') diff --git a/src/http/render.rs b/src/http/render.rs index f3e4669..fdf5676 100644 --- a/src/http/render.rs +++ b/src/http/render.rs @@ -51,14 +51,14 @@ impl Page { #[derive(Template)] #[template(path = "login.html")] -pub struct Login { +pub(crate) struct Login { pub page: Page, pub error: String, } #[derive(Template)] #[template(path = "error.html")] -pub struct ErrorPage { +pub(crate) struct ErrorPage { pub page: Page, pub status: String, pub message: String, @@ -67,7 +67,7 @@ pub struct ErrorPage { #[derive(Template)] #[template(path = "dashboard.html")] -pub struct Dashboard { +pub(crate) struct Dashboard { pub page: Page, pub subscriptions: i64, pub index_count: i64, @@ -78,7 +78,7 @@ pub struct Dashboard { } #[derive(Debug, Clone)] -pub struct PublishRow { +pub(crate) struct PublishRow { pub name: String, pub version: String, pub published_at: String, @@ -88,13 +88,13 @@ pub struct PublishRow { #[derive(Template)] #[template(path = "reviews.html")] -pub struct ReviewsPage { +pub(crate) struct ReviewsPage { pub page: Page, pub rows: Vec, } #[derive(Debug, Clone)] -pub struct ReviewRow { +pub(crate) struct ReviewRow { pub id: i64, pub pkgbase: String, pub version: String, @@ -107,7 +107,7 @@ pub struct ReviewRow { #[derive(Template)] #[template(path = "review.html")] -pub struct ReviewDetail { +pub(crate) struct ReviewDetail { pub page: Page, pub c: ReviewHead, pub base_version: String, @@ -121,7 +121,7 @@ pub struct ReviewDetail { } #[derive(Debug, Clone)] -pub struct ReviewHead { +pub(crate) struct ReviewHead { pub id: i64, pub pkgbase: String, pub version: String, @@ -165,7 +165,7 @@ pub struct Subscriptions { } #[derive(Debug, Clone)] -pub struct SubRow { +pub(crate) struct SubRow { pub name: String, pub state: String, pub maintainer: String, @@ -191,7 +191,7 @@ pub struct Attention { } #[derive(Debug, Clone)] -pub struct UnbuiltRow { +pub(crate) struct UnbuiltRow { pub pkgbase: String, pub approved: String, pub serving: String, @@ -200,7 +200,7 @@ pub struct UnbuiltRow { } #[derive(Debug, Clone)] -pub struct NoticeRow { +pub(crate) struct NoticeRow { pub id: i64, pub pkgbase: String, pub kind: String, @@ -210,7 +210,7 @@ pub struct NoticeRow { } #[derive(Debug, Clone)] -pub struct StaleRow { +pub(crate) struct StaleRow { pub pkgbase: String, pub dependency: String, pub built_with: String, @@ -218,7 +218,7 @@ pub struct StaleRow { } #[derive(Debug, Clone)] -pub struct BlockedRow { +pub(crate) struct BlockedRow { pub id: String, pub id_short: String, pub pkgbase: String, @@ -235,7 +235,7 @@ pub struct Packages { } #[derive(Debug, Clone)] -pub struct IndexRow { +pub(crate) struct IndexRow { pub name: String, pub version: String, pub arch: String, @@ -245,7 +245,7 @@ pub struct IndexRow { #[derive(Template)] #[template(path = "package.html")] -pub struct PackageDetail { +pub(crate) struct PackageDetail { pub page: Page, pub name: String, pub summary: String, @@ -259,7 +259,7 @@ pub struct PackageDetail { } #[derive(Debug, Clone)] -pub struct TimelineRow { +pub(crate) struct TimelineRow { pub version: String, pub state: String, pub aur_commit: String, @@ -278,14 +278,14 @@ pub struct Builds { #[derive(Template)] #[template(path = "builds_table.html")] -pub struct BuildsTable { +pub(crate) struct BuildsTable { pub page: Page, pub rows: Vec, pub recent: Vec, } #[derive(Debug, Clone)] -pub struct BuildLite { +pub(crate) struct BuildLite { pub id: String, pub id_short: String, pub kind: String, @@ -309,7 +309,7 @@ pub struct BuildRow { #[derive(Template)] #[template(path = "build.html")] -pub struct BuildDetail { +pub(crate) struct BuildDetail { pub page: Page, pub id: String, pub id_short: String, @@ -326,7 +326,7 @@ pub struct BuildDetail { } #[derive(Debug, Clone)] -pub struct StepRow { +pub(crate) struct StepRow { pub step: String, pub status: String, pub attempt: i64, @@ -343,7 +343,7 @@ pub struct Audit { } #[derive(Debug, Clone)] -pub struct AuditRow { +pub(crate) struct AuditRow { pub at: String, pub actor_kind: String, pub actor: String, @@ -355,19 +355,19 @@ pub struct AuditRow { #[derive(Template)] #[template(path = "settings.html")] -pub struct Settings { +pub(crate) struct Settings { pub page: Page, pub rows: Vec, pub repo: String, } #[derive(Debug, Clone)] -pub struct SettingRow { +pub(crate) struct SettingRow { pub key: String, pub value: String, } -pub fn static_asset(name: &str, accept_gzip: bool) -> crate::http::Res { +pub(crate) fn static_asset(name: &str, accept_gzip: bool) -> crate::http::Res { use crate::http::Res; match name { "app.css" => { -- cgit v1.2.3