diff options
| author | aur-build <aur-build@localhost> | 2026-11-21 13:28:55 +0000 |
|---|---|---|
| committer | aur-build <aur-build@localhost> | 2026-11-21 13:28:55 +0000 |
| commit | 48fecfe03be4f214eaf4f9c49cb3c27496bb74ba (patch) | |
| tree | 432f6e32351df60d36a115561c1bf8b8013c5430 /src/http/mod.rs | |
| parent | a200edaac2056dd9c85d6bddff3ca181f0cc277e (diff) | |
| download | aur-build-48fecfe03be4f214eaf4f9c49cb3c27496bb74ba.tar.gz aur-build-48fecfe03be4f214eaf4f9c49cb3c27496bb74ba.zip | |
src: narrow what only its own module reads, and delete what nothing reads at all
The census's 35 `deadonly` items were a lead, not a verdict, and the compiler
answered it: 17 of them are read only inside their own module and were declared
`pub` for no reason, so they are `pub(crate)` now — `db::OpenReview` and its two
queries, `ReviewSubject` and its query, `fetch::Body`, `http`'s `form_get`,
`query_get` and `Page::flash`, `ops::EvictPlan`, `usecase`'s `StageB`… — and two
are read by nobody: `ReleaseState::can_transition` and
`SubscriptionState::can_transition`, both already annotated "nothing consults
this table today", which is the definition of dead rather than the argument for
keeping.
Narrowing them is what made the compiler look harder, and it found three more:
`ReviewSubject::pkgbase` was selected out of the database and never read,
`StageB::cached` was written in three places and never read, and
`StageB::version` was never called. All gone, the SELECT column with them.
The other 18 cannot be narrowed and now say so, once at the declaration and once
in the budget file: a row type the `aur-build` binary binds without naming
(`PackageRow`, `Checked`, `GcPlan`, `Prepared`), a type behind a `pub` fn a test
calls (`Unbuilt`, `BulkItem`, `StageA`, `CheckReport`, `PkgInfo`, `Installed`,
`Subscription`, `Manifest`), a trait a public test provisioner implements
(`Provisioner`, `ProvisionRequest`), and three that a release build never even
compiles because their module is `test-support`-gated (`shims::*`, `VirtualClock`).
`deadonly` therefore means *dead and unargued* now: an allowlisted item leaves the
dead columns, which is the only way the number can be held at zero forever.
448 pub, 49 dead, 0 unargued; 284 tests pass, one ignored, none lost.
Diffstat (limited to 'src/http/mod.rs')
| -rw-r--r-- | src/http/mod.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/http/mod.rs b/src/http/mod.rs index 60a1f2e..8a00745 100644 --- a/src/http/mod.rs +++ b/src/http/mod.rs @@ -28,10 +28,10 @@ impl Req { pub(crate) fn form(&self) -> &[(String, String)] { &self.form_pairs } - pub fn form_get(&self, key: &str) -> Option<String> { + pub(crate) fn form_get(&self, key: &str) -> Option<String> { self.form_pairs.iter().find(|(k, _)| k == key).map(|(_, v)| v.clone()) } - pub fn query_get(&self, key: &str) -> Option<String> { + pub(crate) fn query_get(&self, key: &str) -> Option<String> { 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. |
