From 1e1e12e7220a3fd288782ae40f0823db32acf6cb Mon Sep 17 00:00:00 2001 From: aur-build Date: Sun, 22 Nov 2026 10:44:04 +0000 Subject: src,tests: say each thing once, in the code or not at all MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/pkgver/mod.rs | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) (limited to 'src/pkgver') diff --git a/src/pkgver/mod.rs b/src/pkgver/mod.rs index 5abb5c0..876f436 100644 --- a/src/pkgver/mod.rs +++ b/src/pkgver/mod.rs @@ -21,10 +21,7 @@ fn split_full_version(v: &str) -> (String, String, String) { } } -/// The real definition. The module is private, so this `pub` -/// is not a nameable path from outside; the alias below is the -/// only way to reach it, and the alias is what carries the -/// feature-conditional visibility. +/// The real definition; the alias below carries the feature-conditional visibility. mod version { #[derive(Debug, Clone, PartialEq, Eq)] pub struct Version { @@ -34,11 +31,8 @@ mod version { } } -/// a parsed epoch-ver-rel. Every caller uses the value `parse` hands back without naming the type; the tests that pin the ordering do name it. -/// -/// `pub` only under `test-support`. Production reaches the type -/// through its own module and never names it from outside; the -/// outside reader that needs the name is a test. +/// A parsed epoch-ver-rel. Only tests name the type; production uses the value +/// `parse` hands back. #[cfg(feature = "test-support")] pub use version::Version; @@ -186,8 +180,6 @@ pub fn is_downgrade(current: &str, new: &str) -> bool { vercmp(current, new) == Ordering::Greater } -// ------------------------------------------------------------- dep strings -- - #[derive(Debug, Clone, PartialEq, Eq)] enum DepOp { Any, @@ -240,8 +232,7 @@ impl Dep { Some(Dep { name: s.trim().to_string(), op: DepOp::Any, version: None }) } - /// Only the tests inside this module ask for a `Dep`'s name; production - /// reads the field. Gated so the release build does not compile it. + /// Asked for only by this module's tests; production reads the field. #[cfg(test)] fn name(&self) -> &str { &self.name @@ -335,13 +326,6 @@ mod tests { assert!(Dep::parse("foo").unwrap().satisfied_by("anything")); } - // --------------------------------------------------------------------- - // Moved verbatim from tests/versions.rs: every test here is a function of - // its arguments alone — no database, no fixture, no temporary directory — - // which is what makes it a unit test of this module rather than a consumer - // of it. - // --------------------------------------------------------------------- - const ORDERED: &[(&str, &str)] = &[ ("v1.2.3", "v1.2.4"), ("1.0", "1.1"), -- cgit v1.2.3