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. --- src/db/invariants.rs | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'src/db/invariants.rs') diff --git a/src/db/invariants.rs b/src/db/invariants.rs index e9e133f..964b03c 100644 --- a/src/db/invariants.rs +++ b/src/db/invariants.rs @@ -1,5 +1,4 @@ - -use crate::db::*; +use crate::db::Db; use crate::error::Result; // ------------------------------------------------------- invariant helpers -- @@ -29,7 +28,6 @@ pub fn unapproved_index_entries(db: &Db) -> Result> { }) } - #[derive(Debug, Clone)] // Unbuilt stays `pub`: the attention row `approved_but_unbuilt` returns to the web UI and to tests/crash.rs. pub struct Unbuilt { @@ -76,21 +74,14 @@ pub fn approved_but_unbuilt(db: &Db) -> Result> { let mut out = Vec::new(); for r in rows { let (pkgbase, ae, av, ar, se, sv, sr, error, build_id) = r?; - let (pkgbase, av, ar) = match (pkgbase, av, ar) { - (Some(p), Some(v), Some(rel)) => (p, v, rel), - _ => { - return Err(crate::error::Error::Db( - "failed build row without a candidate version".into(), - )) - } + let (Some(pkgbase), Some(av), Some(ar)) = (pkgbase, av, ar) else { + return Err(crate::error::Error::Db("failed build row without a candidate version".into())); }; out.push(Unbuilt { pkgbase, approved: crate::pkgver::full_version(&ae.unwrap_or_default(), &av, &ar), serving: match (sv, sr) { - (Some(v), Some(rel)) => { - crate::pkgver::full_version(&se.unwrap_or_default(), &v, &rel) - } + (Some(v), Some(rel)) => crate::pkgver::full_version(&se.unwrap_or_default(), &v, &rel), _ => String::new(), }, error, -- cgit v1.2.3