diff options
| author | dev <dev@localhost> | 2026-11-20 18:49:22 +0000 |
|---|---|---|
| committer | dev <dev@localhost> | 2026-11-20 18:49:22 +0000 |
| commit | 6c4b4394bd8ddf28d130e87e0100349f13f6e912 (patch) | |
| tree | ebba70a9a141d05cb0251663aaacea858ec79115 /tests | |
| parent | 895f3547043def08f0822f936ae34458315f6982 (diff) | |
| download | aur-build-6c4b4394bd8ddf28d130e87e0100349f13f6e912.tar.gz aur-build-6c4b4394bd8ddf28d130e87e0100349f13f6e912.zip | |
foundation, http: export what is used above you, and nothing else
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.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/architecture-budget.json | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/tests/architecture-budget.json b/tests/architecture-budget.json index 9d63943..422bfb5 100644 --- a/tests/architecture-budget.json +++ b/tests/architecture-budget.json @@ -78,19 +78,19 @@ "test": 0 }, "config": { - "dead": 9, - "deadonly": 4, + "dead": 5, + "deadonly": 0, "glob": 0, "largest": 427, "largest_file": "src/config.rs", "lines": 427, "priv": 0, - "pub": 35, + "pub": 31, "test": 5 }, "db": { - "dead": 24, - "deadonly": 11, + "dead": 21, + "deadonly": 8, "glob": 0, "largest": 364, "largest_file": "src/db/candidates.rs", @@ -122,36 +122,36 @@ "test": 0 }, "git": { - "dead": 5, - "deadonly": 5, + "dead": 0, + "deadonly": 0, "glob": 0, - "largest": 280, + "largest": 240, "largest_file": "src/git.rs", - "lines": 280, + "lines": 240, "priv": 0, - "pub": 19, + "pub": 14, "test": 0 }, "hash": { - "dead": 1, - "deadonly": 1, + "dead": 0, + "deadonly": 0, "glob": 0, - "largest": 61, + "largest": 59, "largest_file": "src/hash.rs", - "lines": 61, + "lines": 59, "priv": 0, - "pub": 8, + "pub": 7, "test": 0 }, "http": { - "dead": 53, - "deadonly": 43, - "glob": 2, + "dead": 13, + "deadonly": 3, + "glob": 0, "largest": 565, "largest_file": "src/http/routes/pages.rs", - "lines": 1938, - "priv": 32, - "pub": 68, + "lines": 1922, + "priv": 67, + "pub": 27, "test": 10 }, "lib": { @@ -199,36 +199,36 @@ "test": 6 }, "pkginfo": { - "dead": 3, - "deadonly": 3, + "dead": 2, + "deadonly": 2, "glob": 0, - "largest": 122, + "largest": 115, "largest_file": "src/pkginfo.rs", - "lines": 122, + "lines": 115, "priv": 0, - "pub": 7, + "pub": 6, "test": 0 }, "pkgver": { - "dead": 9, - "deadonly": 4, + "dead": 5, + "deadonly": 0, "glob": 0, - "largest": 347, + "largest": 343, "largest_file": "src/pkgver/mod.rs", - "lines": 347, + "lines": 343, "priv": 0, - "pub": 18, + "pub": 14, "test": 5 }, "recipe": { - "dead": 4, - "deadonly": 4, + "dead": 0, + "deadonly": 0, "glob": 0, - "largest": 467, + "largest": 459, "largest_file": "src/recipe.rs", - "lines": 467, + "lines": 459, "priv": 0, - "pub": 11, + "pub": 7, "test": 0 }, "review": { @@ -265,25 +265,25 @@ "test": 4 }, "time": { - "dead": 7, - "deadonly": 4, + "dead": 5, + "deadonly": 2, "glob": 0, - "largest": 221, + "largest": 206, "largest_file": "src/time.rs", - "lines": 221, + "lines": 206, "priv": 0, - "pub": 16, + "pub": 14, "test": 3 }, "urlutil": { - "dead": 1, - "deadonly": 1, + "dead": 0, + "deadonly": 0, "glob": 0, "largest": 56, "largest_file": "src/urlutil.rs", "lines": 56, "priv": 0, - "pub": 2, + "pub": 1, "test": 0 }, "usecase": { @@ -310,15 +310,15 @@ } }, "totals": { - "dead": 180, - "deadonly": 105, + "dead": 115, + "deadonly": 40, "edges": 87, - "glob": 2, + "glob": 0, "largest": 603, "largest_file": "src/shims/mod.rs", - "lines": 14336, - "priv": 68, - "pub": 579, + "lines": 14244, + "priv": 103, + "pub": 516, "test": 75 } } |
