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/world.rs | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'tests/world.rs') diff --git a/tests/world.rs b/tests/world.rs index 4d1e2bc..d8e61b5 100644 --- a/tests/world.rs +++ b/tests/world.rs @@ -5,7 +5,12 @@ use aur_build::pipeline; use aur_build::pkginfo; use common::*; -fn make_archive(dir: &std::path::Path, name: &str, pkginfo: Option<&str>, buildinfo: Option<&str>) -> std::path::PathBuf { +fn make_archive( + dir: &std::path::Path, + name: &str, + pkginfo: Option<&str>, + buildinfo: Option<&str>, +) -> std::path::PathBuf { let path = dir.join(format!("{name}.pkg.tar.zst")); let enc = std::io::BufWriter::new(std::fs::File::create(&path).unwrap()); let mut enc = zstd::Encoder::new(enc, 3).unwrap(); @@ -153,17 +158,21 @@ fn a_split_pkgbase_is_one_approval_and_many_index_rows() { WHERE p.state='in_index' ORDER BY p.name", )?; let out = st - .query_map([], |r| Ok(format!("{} {} art={:?}", r.get::<_, String>(0)?, r.get::<_, String>(1)?, r.get::<_, Option>(2)?)))? - .filter_map(|x| x.ok()) + .query_map([], |r| { + Ok(format!( + "{} {} art={:?}", + r.get::<_, String>(0)?, + r.get::<_, String>(1)?, + r.get::<_, Option>(2)? + )) + })? + .filter_map(std::result::Result::ok) .collect(); Ok(out) }) .unwrap(); assert!(rows.len() >= 2, "a split pkgbase should produce several index rows: {rows:?}"); - assert!( - rows.iter().all(|r| r.contains("art=Some")), - "every index row needs its own artifact: {rows:?}" - ); + assert!(rows.iter().all(|r| r.contains("art=Some")), "every index row needs its own artifact: {rows:?}"); assert_eq!(env.query_i64("SELECT count(*) FROM approval", &[]), Some(1)); assert_eq!(env.query_i64("SELECT count(*) FROM release", &[]), Some(1)); } -- cgit v1.2.3