summaryrefslogtreecommitdiffstats
path: root/tests/staleness.rs
diff options
context:
space:
mode:
authoraur-build <aur-build@localhost>2026-11-22 10:36:24 +0000
committeraur-build <aur-build@localhost>2026-11-22 10:36:24 +0000
commit3dc71b2f5160ef9bd46143eed0edb5d2557b58e6 (patch)
tree7cc7169181b4bdd73fd8817f8c1d7cce6e6998a8 /tests/staleness.rs
parent9dc9087d89891c6e5ef7e5dc084dd13c8611843e (diff)
downloadaur-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/staleness.rs')
-rw-r--r--tests/staleness.rs19
1 files changed, 11 insertions, 8 deletions
diff --git a/tests/staleness.rs b/tests/staleness.rs
index b5a5ac1..1fc05f9 100644
--- a/tests/staleness.rs
+++ b/tests/staleness.rs
@@ -45,7 +45,7 @@ fn staleness_is_derived_on_read_and_nothing_stores_it() {
"SELECT m.name || '.' || p.name FROM sqlite_master m, pragma_table_info(m.name) p
WHERE m.type='table' AND p.name LIKE '%stale%'",
)?;
- let out = st.query_map([], |r| r.get::<_, String>(0))?.filter_map(|x| x.ok()).collect();
+ let out = st.query_map([], |r| r.get::<_, String>(0))?.filter_map(std::result::Result::ok).collect();
Ok(out)
})
.unwrap();
@@ -58,7 +58,10 @@ fn staleness_is_derived_on_read_and_nothing_stores_it() {
"withdrawing the dependency should flip the answer to missing: {after:?}"
);
assert_eq!(
- env.query_i64("SELECT count(*) FROM release WHERE pkgbase_id=(SELECT id FROM pkgbase WHERE name='dep-client')", &[]),
+ env.query_i64(
+ "SELECT count(*) FROM release WHERE pkgbase_id=(SELECT id FROM pkgbase WHERE name='dep-client')",
+ &[]
+ ),
Some(1),
"the dependent was untouched by its dependency moving"
);
@@ -105,7 +108,11 @@ fn a_blocked_build_waits_and_is_requeued_only_when_the_blocker_arrives() {
"dep-partner should be in the index now: {:?}",
aur_build::db::our_package_names(&env.db)
);
- assert_eq!(builds::get(&env.db, &id).unwrap().unwrap().state, BuildState::Queued, "the blocker arrived and the build stayed blocked");
+ assert_eq!(
+ builds::get(&env.db, &id).unwrap().unwrap().state,
+ BuildState::Queued,
+ "the blocker arrived and the build stayed blocked"
+ );
assert_eq!(builds::requeue_blocked(&env.db).unwrap(), 0, "nothing left to requeue");
pipeline::run(&env.cfg, &env.db, &id).unwrap();
@@ -157,11 +164,7 @@ fn a_dependency_we_stopped_publishing_shows_as_missing_not_outdated() {
pipeline::publish::withdraw_package(&env.cfg, &env.db, "plain-make").unwrap();
let stale = staleness::stale_rows(&env.db).unwrap();
- let missing: Vec<_> = stale
- .iter()
- .filter(|s| s.kind == staleness::Kind::Missing)
- .cloned()
- .collect();
+ let missing: Vec<_> = stale.iter().filter(|s| s.kind == staleness::Kind::Missing).cloned().collect();
assert_eq!(missing.len(), 1, "withdrawal should read as missing: {stale:?}");
assert_eq!(missing[0].pkgbase, "dep-client");
assert_eq!(missing[0].dependency, "plain-make");