diff options
| author | aur-build <aur-build@localhost> | 2026-11-22 10:44:04 +0000 |
|---|---|---|
| committer | aur-build <aur-build@localhost> | 2026-11-22 10:44:04 +0000 |
| commit | 1e1e12e7220a3fd288782ae40f0823db32acf6cb (patch) | |
| tree | 1e436bfbe305cbeccee93758e67d1ca11e3096e6 /src/http | |
| parent | 3dc71b2f5160ef9bd46143eed0edb5d2557b58e6 (diff) | |
| download | aur-build-1e1e12e7220a3fd288782ae40f0823db32acf6cb.tar.gz aur-build-1e1e12e7220a3fd288782ae40f0823db32acf6cb.zip | |
src,tests: say each thing once, in the code or not at all
The repeated explanations go: sixteen copies of why a `pub` under
`test-support` has two declarations, six notes about where a test moved
from, forty-three banner comments naming the section they sit above.
The prose that stays is the prose the code cannot say — a hand-written
Debug that keeps a token out of a log line, a git pipe that would
deadlock if the write came first, an end-of-string check that has to
precede the separator skip. Enum docs in error.rs collapse to the line
that names what the type is; the argument for why it is shaped that way
is in the variants.
Diffstat (limited to 'src/http')
| -rw-r--r-- | src/http/mod.rs | 3 | ||||
| -rw-r--r-- | src/http/routes/mod.rs | 5 | ||||
| -rw-r--r-- | src/http/routes/mutations.rs | 2 | ||||
| -rw-r--r-- | src/http/routes/pages.rs | 14 |
4 files changed, 0 insertions, 24 deletions
diff --git a/src/http/mod.rs b/src/http/mod.rs index a437978..aea21dc 100644 --- a/src/http/mod.rs +++ b/src/http/mod.rs @@ -35,9 +35,6 @@ impl Req { self.query_pairs.iter().find(|(k, _)| k == key).map(|(_, v)| v.clone()) } /// Reading a cookie off a request is internal plumbing; the auth tests need it in order to forge one. - /// - /// Module-internal in a production build, `pub` only under `test-support`: - /// one body behind two visibility declarations, exactly one of which compiles. #[cfg(feature = "test-support")] pub fn cookie(&self, name: &str) -> Option<String> { Self::cookie_impl(self, name) diff --git a/src/http/routes/mod.rs b/src/http/routes/mod.rs index 1affabf..301fe89 100644 --- a/src/http/routes/mod.rs +++ b/src/http/routes/mod.rs @@ -50,9 +50,6 @@ fn logout(req: &Req) -> Res { } /// The router dispatches to it. The login tests drive a live listener, so they cannot move into the module. -/// -/// Module-internal in a production build, `pub` only under `test-support`: -/// one body behind two visibility declarations, exactly one of which compiles. #[cfg(feature = "test-support")] pub fn login(state: &State, req: &Req) -> Res { login_impl(state, req) @@ -195,8 +192,6 @@ fn flash_sub(state: &State, req: &Req, msg: &str, err: bool) -> Res { page_to_res(Subscriptions { page, rows }, 200) } -// ------------------------------------------------------------ rendering -- - fn page_to_res<T: askama::Template>(t: T, status: u16) -> Res { match askama::Template::render(&t) { Ok(body) => Res::html(status, body), diff --git a/src/http/routes/mutations.rs b/src/http/routes/mutations.rs index 0d3b188..508bf48 100644 --- a/src/http/routes/mutations.rs +++ b/src/http/routes/mutations.rs @@ -7,8 +7,6 @@ use super::{ Packages, ReviewDetail, ReviewsPage, }; -// -------------------------------------------------------------- approve -- - pub(crate) fn review_approve(state: &State, req: &Req, id: &str) -> Res { let db = &state.db; let Some(id) = id.parse::<i64>().ok() else { diff --git a/src/http/routes/pages.rs b/src/http/routes/pages.rs index 9081180..1500804 100644 --- a/src/http/routes/pages.rs +++ b/src/http/routes/pages.rs @@ -11,8 +11,6 @@ use super::{ UnbuiltRow, }; -// ------------------------------------------------------------- dashboard -- - pub(crate) fn dashboard(state: &State, req: &Req) -> Res { let db = &state.db; let page = chrome(state, req, "Dashboard", ""); @@ -45,8 +43,6 @@ pub(crate) fn dashboard(state: &State, req: &Req) -> Res { ) } -// ---------------------------------------------------------------- inbox -- - pub(crate) fn review_rows(db: &Db) -> Vec<ReviewRow> { let mut rows: Vec<ReviewRow> = candidates::pending_candidates(db) .unwrap_or_default() @@ -167,8 +163,6 @@ pub(crate) fn review_body(state: &State, c: &CandidateRow) -> (ReviewHead, Vec<P (head, shown, recipe_text, srcinfo, sources_resolved, deps_resolved) } -// -------------------------------------------------------- subscriptions -- - pub(crate) fn subscriptions(state: &State, req: &Req) -> Res { let db = &state.db; let page = chrome(state, req, "Subscriptions", "nav_subscriptions"); @@ -191,8 +185,6 @@ pub(crate) fn subscriptions(state: &State, req: &Req) -> Res { page_to_res(Subscriptions { page, rows }, 200) } -// ------------------------------------------------------------ attention -- - pub(crate) fn attention(state: &State, req: &Req) -> Res { let db = &state.db; let page = chrome(state, req, "Attention", "nav_attention"); @@ -247,8 +239,6 @@ pub(crate) fn attention(state: &State, req: &Req) -> Res { page_to_res(Attention { page, empty, notices, unbuilt, outdated, missing, downgrades, blocked }, 200) } -// ------------------------------------------------------------- packages -- - pub(crate) fn packages(state: &State, req: &Req) -> Res { let db = &state.db; let page = chrome(state, req, "Index", "nav_packages"); @@ -350,8 +340,6 @@ pub(crate) fn package_detail(state: &State, req: &Req, name: &str) -> Res { ) } -// --------------------------------------------------------------- builds -- - fn build_version(db: &Db, b: &builds::BuildRow) -> String { if let Some(cid) = b.candidate_id { if let Some(c) = candidates::candidate_by_id(db, cid).ok().flatten() { @@ -487,8 +475,6 @@ pub(crate) fn build_log_stream(state: &State, req: &Req, id: &str) -> Res { res } -// ----------------------------------------------------------- ops, config -- - pub(crate) fn audit(state: &State, req: &Req) -> Res { let page = chrome(state, req, "Ops", "nav_audit"); let rows = db::list_audit(&state.db, 200) |
