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/watch/scheduler.rs | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'src/watch/scheduler.rs') diff --git a/src/watch/scheduler.rs b/src/watch/scheduler.rs index 4508a03..5aae7ea 100644 --- a/src/watch/scheduler.rs +++ b/src/watch/scheduler.rs @@ -27,17 +27,12 @@ pub fn spawn_scheduler(cfg: Arc, db: Db, stop: Arc) -> JoinH pub fn sweep(cfg: &Config, db: &Db) -> usize { let now = crate::time::now(); - let due = match db::due_subscriptions(db, &now) { - Ok(d) => d, - Err(_) => return 0, - }; + let Ok(due) = db::due_subscriptions(db, &now) else { return 0 }; let mut n = 0; for sub in due { // Mark it checked first so a slow or hanging source cannot make the // scheduler re-enter it on the next tick. - let interval = sub - .poll_interval_secs - .unwrap_or(crate::db::setting_i64(db, "poll_interval", 86400)); + let interval = sub.poll_interval_secs.unwrap_or(crate::db::setting_i64(db, "poll_interval", 86400)); let _ = db::note_check(&db.writer, &sub.pkgbase, &crate::time::secs_ahead(interval), None); match check_pkgbase(cfg, db, &sub.pkgbase) { Ok(report) => { @@ -51,12 +46,7 @@ pub fn sweep(cfg: &Config, db: &Db) -> usize { } } Err(e) => { - let _ = db::note_check( - &db.writer, - &sub.pkgbase, - &crate::time::secs_ahead(600), - Some(&e.to_string()), - ); + let _ = db::note_check(&db.writer, &sub.pkgbase, &crate::time::secs_ahead(600), Some(&e.to_string())); } } n += 1; -- cgit v1.2.3