From 3dc71b2f5160ef9bd46143eed0edb5d2557b58e6 Mon Sep 17 00:00:00 2001 From: aur-build Date: Sun, 22 Nov 2026 10:36:24 +0000 Subject: rustfmt,lints: pin the formatting, adopt the idiom lints, pay them off rustfmt.toml fixes the shape the tree is written in (120 columns, small items kept on one line) and one canonical pass makes it the truth. [lints.clippy] names the idiom lints worth enforcing and leaves out the two that would add doc-comment boilerplate rather than remove it. The tree pays them off here: write!/writeln! instead of push_str(&format!()), let-else instead of match-on-Option, borrows where a thread entry point only reads what it owns, no `&self` on a Copy state and no `self` nobody reads. ops::to_prometheus gains one gauge helper: a metric's HELP, TYPE and value are now emitted by the same call instead of three. --- tests/production_surface.rs | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) (limited to 'tests/production_surface.rs') diff --git a/tests/production_surface.rs b/tests/production_surface.rs index bcf3e92..bf0a497 100644 --- a/tests/production_surface.rs +++ b/tests/production_surface.rs @@ -49,16 +49,10 @@ fn no_production_module_references_the_shim_harness() { fn the_served_index_has_exactly_one_serialization_lock() { let src = std::fs::read_to_string(Path::new(env!("CARGO_MANIFEST_DIR")).join("src/pipeline/publish.rs")) .expect("read publish.rs"); - let mutexes = src - .lines() - .filter(|l| l.contains("static") && l.contains("Mutex<")) - .collect::>(); + let mutexes = src.lines().filter(|l| l.contains("static") && l.contains("Mutex<")).collect::>(); assert_eq!(mutexes.len(), 1, "publish.rs must declare exactly one serialization mutex, found {mutexes:?}"); assert!(!src.contains("PUBLISH_LOCK"), "the second lock must stay deleted"); - let acquisitions = src - .lines() - .filter(|l| l.contains("lock_repo()") && !l.trim_start().starts_with("fn ")) - .count(); + let acquisitions = src.lines().filter(|l| l.contains("lock_repo()") && !l.trim_start().starts_with("fn ")).count(); assert!( acquisitions >= 2, "publish and withdraw_package must both take the repo lock; found {acquisitions} acquisitions" @@ -67,8 +61,8 @@ fn the_served_index_has_exactly_one_serialization_lock() { #[test] fn the_shim_binaries_are_test_only() { - let manifest = std::fs::read_to_string(Path::new(env!("CARGO_MANIFEST_DIR")).join("Cargo.toml")) - .expect("read Cargo.toml"); + let manifest = + std::fs::read_to_string(Path::new(env!("CARGO_MANIFEST_DIR")).join("Cargo.toml")).expect("read Cargo.toml"); for tool in ["mkarchroot", "makechrootpkg", "makepkg", "repo-add", "gpg", "pacman"] { let block = manifest .split("[[bin]]") @@ -169,20 +163,12 @@ fn the_virtual_clock_is_compiled_out_without_test_support() { fallback.contains("pub fn virtual_sleep() -> bool") && fallback.contains("false"), "the fallback must report a real wait so the seam compiles to a plain sleep" ); - assert!( - !fallback.contains("Mutex"), - "nothing may be locked on the wait path of a production build" - ); + assert!(!fallback.contains("Mutex"), "nothing may be locked on the wait path of a production build"); } #[test] fn control_loops_wait_through_the_clock_seam() { - for file in [ - "src/pipeline/dispatch.rs", - "src/watch/scheduler.rs", - "src/http/sse.rs", - "src/sandbox/remote.rs", - ] { + for file in ["src/pipeline/dispatch.rs", "src/watch/scheduler.rs", "src/http/sse.rs", "src/sandbox/remote.rs"] { let src = read(file); assert!( !src.contains("std::thread::sleep"), -- cgit v1.2.3