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/approvals.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/db/approvals.rs') diff --git a/src/db/approvals.rs b/src/db/approvals.rs index ececc32..0c4a117 100644 --- a/src/db/approvals.rs +++ b/src/db/approvals.rs @@ -33,7 +33,13 @@ pub fn record_in(tx: &mut Transaction<'_>, d: &Decision<'_>) -> Result { Ok(tx.last_insert_rowid()) } -pub fn record_rejection_in(tx: &mut Transaction<'_>, candidate_id: i64, at: &str, identity_hash: &str, note: &str) -> Result<()> { +pub fn record_rejection_in( + tx: &mut Transaction<'_>, + candidate_id: i64, + at: &str, + identity_hash: &str, + note: &str, +) -> Result<()> { tx.execute( "INSERT INTO approval (candidate_id, base_release_id, decided_at, decision, risk_level, diff_digest, identity_hash, note) @@ -46,11 +52,9 @@ pub fn record_rejection_in(tx: &mut Transaction<'_>, candidate_id: i64, at: &str pub fn for_candidate(db: &Db, candidate_id: i64) -> Result> { db.read(|c| { - Ok(c.query_row( - "SELECT id, decision FROM approval WHERE candidate_id=?1", - params![candidate_id], - |r| Ok((r.get(0)?, r.get(1)?)), - ) + Ok(c.query_row("SELECT id, decision FROM approval WHERE candidate_id=?1", params![candidate_id], |r| { + Ok((r.get(0)?, r.get(1)?)) + }) .optional()?) }) } -- cgit v1.2.3