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/world.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/world.rs')
| -rw-r--r-- | tests/world.rs | 23 |
1 files changed, 16 insertions, 7 deletions
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<i64>>(2)?)))? - .filter_map(|x| x.ok()) + .query_map([], |r| { + Ok(format!( + "{} {} art={:?}", + r.get::<_, String>(0)?, + r.get::<_, String>(1)?, + r.get::<_, Option<i64>>(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)); } |
