diff options
| author | aur-build <aur-build@localhost> | 2026-11-22 10:36:24 +0000 |
|---|---|---|
| committer | aur-build <aur-build@localhost> | 2026-11-22 10:36:24 +0000 |
| commit | 3dc71b2f5160ef9bd46143eed0edb5d2557b58e6 (patch) | |
| tree | 7cc7169181b4bdd73fd8817f8c1d7cce6e6998a8 /tests/production_surface.rs | |
| parent | 9dc9087d89891c6e5ef7e5dc084dd13c8611843e (diff) | |
| download | aur-build-3dc71b2f5160ef9bd46143eed0edb5d2557b58e6.tar.gz aur-build-3dc71b2f5160ef9bd46143eed0edb5d2557b58e6.zip | |
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.
Diffstat (limited to 'tests/production_surface.rs')
| -rw-r--r-- | tests/production_surface.rs | 26 |
1 files changed, 6 insertions, 20 deletions
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::<Vec<_>>(); + let mutexes = src.lines().filter(|l| l.contains("static") && l.contains("Mutex<")).collect::<Vec<_>>(); 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"), |
