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/state_machine.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/state_machine.rs')
| -rw-r--r-- | tests/state_machine.rs | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/tests/state_machine.rs b/tests/state_machine.rs index ccfdc42..f355e8f 100644 --- a/tests/state_machine.rs +++ b/tests/state_machine.rs @@ -1,6 +1,9 @@ mod common; -use aur_build::db::{builds, model::{BuildState, CandidateState, StepState}}; +use aur_build::db::{ + builds, + model::{BuildState, CandidateState, StepState}, +}; use common::Env; // What remains all moves real rows through real transitions against a // database. The two tests that were only about the state enum — the column-text @@ -124,16 +127,11 @@ fn candidate(env: &Env, state: &str) -> i64 { } fn resolve(env: &Env, id: i64, to: CandidateState) -> aur_build::error::Result<()> { - env.db - .writer - .tx_for_tests(move |tx| aur_build::db::candidates::resolve_in(tx, id, to, "2026-01-01T00:00:00Z")) + env.db.writer.tx_for_tests(move |tx| aur_build::db::candidates::resolve_in(tx, id, to, "2026-01-01T00:00:00Z")) } fn candidate_state(env: &Env, id: i64) -> CandidateState { - aur_build::db::candidates::by_id(&env.db, id) - .unwrap() - .expect("candidate") - .state + aur_build::db::candidates::by_id(&env.db, id).unwrap().expect("candidate").state } #[test] @@ -190,19 +188,13 @@ fn an_interrupted_step_resumes_and_a_blocked_step_waits() { fn an_unnamed_state_in_any_row_is_an_error() { let env = Env::new(); let cid = candidate(&env, "approved"); - env.exec( - "UPDATE candidate SET state='reconsidered' WHERE id=?1", - &[common::P::I(cid)], - ); + env.exec("UPDATE candidate SET state='reconsidered' WHERE id=?1", &[common::P::I(cid)]); let err = aur_build::db::candidates::by_id(&env.db, cid).unwrap_err(); assert!(err.to_string().contains("candidate has a state outside"), "{err}"); let id = build(&env, "b1"); builds::begin_step(&env.db, &id, "build", 1).unwrap(); - env.exec( - "UPDATE build_step SET status='maybe' WHERE build_id=?1 AND step='build'", - &[common::P::S(id.clone())], - ); + env.exec("UPDATE build_step SET status='maybe' WHERE build_id=?1 AND step='build'", &[common::P::S(id.clone())]); let err = builds::step_status(&env.db, &id, "build").unwrap_err(); assert!(err.to_string().contains("build step has a state outside"), "{err}"); } |
