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/failure_modes.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/failure_modes.rs')
| -rw-r--r-- | tests/failure_modes.rs | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/tests/failure_modes.rs b/tests/failure_modes.rs index 4e7446a..cc5cd44 100644 --- a/tests/failure_modes.rs +++ b/tests/failure_modes.rs @@ -55,12 +55,8 @@ impl Sandbox for FakeSandbox { } fn run(&self, cmd: &aur_build::sandbox::Cmd, on_log: &mut dyn FnMut(&[u8])) -> Result<Exit> { match self.fault { - Fault::DieMidRun if Self::is_build(cmd) => { - Err(Error::other("sandbox vanished mid-run (connection reset)")) - } - Fault::TtlMidBuild if Self::is_build(cmd) => { - Err(Error::other("sandbox ttl expired during build")) - } + Fault::DieMidRun if Self::is_build(cmd) => Err(Error::other("sandbox vanished mid-run (connection reset)")), + Fault::TtlMidBuild if Self::is_build(cmd) => Err(Error::other("sandbox ttl expired during build")), Fault::EmptyWorld if Self::is_query(cmd) => { Ok(Exit { code: Some(0), stdout: Vec::new(), stderr: Vec::new() }) } @@ -113,10 +109,7 @@ fn a_sandbox_that_dies_mid_run_expires_its_lease_and_the_requeue_finishes_the_bu ); assert_eq!(builds::reap_expired(&env.db).unwrap(), 1); - assert!(matches!( - pipeline::run(&env.cfg, &env.db, &id).unwrap(), - pipeline::Outcome::Succeeded { .. } - )); + assert!(matches!(pipeline::run(&env.cfg, &env.db, &id).unwrap(), pipeline::Outcome::Succeeded { .. })); assert_eq!(db::index_version(&env.db, "plain-make").unwrap().as_deref(), Some("1.0-1")); } @@ -151,11 +144,7 @@ fn a_full_pool_blocks_the_build_instead_of_breaking_it() { BuildState::BlockedMissingDep, "the build waits for capacity on the same blocked machinery it uses for missing deps, unharmed" ); - assert_eq!( - b.blocked_on_json.as_str(), - r#"["sandbox-pool"]"#, - "the block names what it waits on" - ); + assert_eq!(b.blocked_on_json.as_str(), r#"["sandbox-pool"]"#, "the block names what it waits on"); } #[test] |
