From bb1d533515c8f63faacb00b3ef59232cf2d4a1c5 Mon Sep 17 00:00:00 2001 From: dev Date: Sat, 21 Nov 2026 19:29:41 +0000 Subject: pipeline,sandbox,shims: thirty-two more markers the compiler was willing to take MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The whole `shims` module is behind `test-support`, so its thirteen `pub(crate)` items were invisible to a release build already — but `pub(crate)` still made each of them part of the crate's interface to every other module, and none of them had a reader outside the file that declares it. `manifest`, `record`, `split_version`, `valid_db_arg`, `DB_SUFFIXES` and the nine tool entry points are now private to `src/shims/mod.rs`, which is where the shim binaries reach them through the module's own `pub` surface. `pipeline` went 16 -> 4 and `sandbox` 16 -> 9. Two refusals are worth the sentence: `SourceIdentity` is the type of the `pub(crate)` field `Ctx::src`, and a field may not be more reachable than its type, so making it private is the `private_interfaces` warning rather than a legal narrowing. `provision_request` is declared inside the private `kata_backend` module and called from the sibling `#[cfg(test)] mod tests`, and privacy does not cross to a sibling — E0624. Both are argued in `over_visibility.allowlist` now instead of sitting unexplained. `LOW` in `review` is the same sibling case one level up: it lives in the `pub mod level` nested in risk.rs and the scorer in the parent module reads `level::LOW`, so `pub(crate)` is the narrowest thing that reaches, given that this crate does not admit `pub(super)`. priv 149 -> 117, overwide 21 -> 0 unargued. `cargo check` clean under both profiles with no new warnings; tests/pipeline.rs, remote_agent.rs, kata.rs, approve.rs, shims.rs and world.rs pass (62 tests), and `cargo test --test architecture` is 16 passed. --- src/shims/mod.rs | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/shims/mod.rs') diff --git a/src/shims/mod.rs b/src/shims/mod.rs index 8e6e231..a918515 100644 --- a/src/shims/mod.rs +++ b/src/shims/mod.rs @@ -42,7 +42,7 @@ impl Default for FakePackage { } impl FakePackage { - pub(crate) fn split_version(&self) -> (String, String) { + fn split_version(&self) -> (String, String) { match self.version.rsplit_once('-') { Some((v, r)) => (v.to_string(), r.to_string()), None => (self.version.clone(), "1".into()), @@ -98,7 +98,7 @@ pub fn manifest() -> Manifest { } #[cfg(not(feature = "test-support"))] -pub(crate) fn manifest() -> Manifest { +fn manifest() -> Manifest { manifest_impl() } @@ -113,7 +113,7 @@ fn manifest_impl() -> Manifest { } /// Called by `run` to log the invocation; nothing outside `shims` records a shim call. -pub(crate) fn record(tool: &str, args: &[String]) { +fn record(tool: &str, args: &[String]) { let dir = match std::env::var("AUR_SHIM_DIR") { Ok(d) => d, Err(_) => return, @@ -211,7 +211,7 @@ pub fn run(tool: &str) -> i32 { } /// Reached only through `run`, which matches the tool name to it. The tool name appears in test strings, which is not a caller. -pub(crate) fn mkarchroot(args: &[String]) -> Result { +fn mkarchroot(args: &[String]) -> Result { let mut target = None; let mut skip = false; for a in args { @@ -235,7 +235,7 @@ pub(crate) fn mkarchroot(args: &[String]) -> Result { } /// Reached only through `run`, which matches the tool name to it. The tool name appears in test strings, which is not a caller. -pub(crate) fn makechrootpkg(args: &[String], m: &Manifest) -> Result { +fn makechrootpkg(args: &[String], m: &Manifest) -> Result { if !args.iter().any(|a| a == "-r") { return Err("makechrootpkg: expected -r ".into()); } @@ -243,7 +243,7 @@ pub(crate) fn makechrootpkg(args: &[String], m: &Manifest) -> Result Result { +fn emit_packages(m: &Manifest, tool: &str, wants_sig: bool) -> Result { for l in &m.log_lines { println!("{l}"); } @@ -323,7 +323,7 @@ fn packages_to_emit(m: &Manifest, startdir: &Path) -> Vec { } } -pub(crate) fn write_package(dir: &Path, p: &FakePackage, m: &Manifest) -> Result { +fn write_package(dir: &Path, p: &FakePackage, m: &Manifest) -> Result { let (pkgver, pkgrel) = p.split_version(); let filename = format!("{}-{}-{}.pkg.tar.zst", p.name, p.version, p.arch); let path = dir.join(&filename); @@ -414,7 +414,7 @@ fn fake_sig(bytes: &[u8]) -> Vec { } /// Reached only through `run`, which matches the tool name to it. The tool name appears in test strings, which is not a caller. -pub(crate) fn makepkg(args: &[String], m: &Manifest) -> Result { +fn makepkg(args: &[String], m: &Manifest) -> Result { if args.iter().any(|a| a == "--vercheck" || a == "-V-check") { let v = m.vercheck.clone().unwrap_or_else(|| "1.0-1".into()); println!("{v}"); @@ -464,7 +464,7 @@ pub(crate) fn makepkg(args: &[String], m: &Manifest) -> Result { } /// Reached only through `run`, which matches the tool name to it. The tool name appears in test strings, which is not a caller. -pub(crate) fn pacman(args: &[String]) -> Result { +fn pacman(args: &[String]) -> Result { if args.iter().any(|a| a == "-U") { for path in args.iter().filter(|a| !a.starts_with('-')) { let p = std::path::Path::new(path); @@ -505,7 +505,7 @@ fn installed_db() -> Option { std::env::var("AUR_SHIM_DIR").ok().map(|d| std::path::Path::new(&d).join("installed.txt")) } -pub(crate) const DB_SUFFIXES: [&str; 5] = [ +const DB_SUFFIXES: [&str; 5] = [ ".db.tar", ".db.tar.gz", ".db.tar.zst", @@ -523,7 +523,7 @@ pub fn valid_db_arg(p: &Path) -> bool { } #[cfg(not(feature = "test-support"))] -pub(crate) fn valid_db_arg(p: &Path) -> bool { +fn valid_db_arg(p: &Path) -> bool { valid_db_arg_impl(p) } @@ -538,7 +538,7 @@ fn valid_db_arg_impl(p: &Path) -> bool { .any(|sfx| name.ends_with(sfx)) } -pub(crate) fn repo_add(args: &[String], _m: &Manifest) -> Result { +fn repo_add(args: &[String], _m: &Manifest) -> Result { let mut positional: Vec<&String> = Vec::new(); let mut skip = false; for a in args { @@ -633,7 +633,7 @@ fn pkginfo_fields(pkg_bytes: &[u8]) -> Result<(String, String, String, String), } /// Reached only through `run`, which matches the tool name to it. The tool name appears in test strings, which is not a caller. -pub(crate) fn gpg(args: &[String]) -> Result { +fn gpg(args: &[String]) -> Result { let out = args .iter() .position(|a| a == "--output" || a == "-o") -- cgit v1.2.3