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/error.rs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'src/error.rs') diff --git a/src/error.rs b/src/error.rs index 2159d46..737dce1 100644 --- a/src/error.rs +++ b/src/error.rs @@ -63,10 +63,9 @@ impl fmt::Display for Refused { Refused::WrongState { entity, id, found, expected } => { write!(f, "{entity} {id} is {found}, not {expected}") } - Refused::PointerMoved { pkgbase } => write!( - f, - "accepted pointer moved while this build was running; refusing to publish ({pkgbase})" - ), + Refused::PointerMoved { pkgbase } => { + write!(f, "accepted pointer moved while this build was running; refusing to publish ({pkgbase})") + } Refused::Other(s) => write!(f, "{s}"), } } @@ -115,7 +114,9 @@ pub enum WorldGap { impl fmt::Display for WorldGap { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { - WorldGap::MissingPin { package } => write!(f, "sandbox world is missing {package} after installing the lease set"), + WorldGap::MissingPin { package } => { + write!(f, "sandbox world is missing {package} after installing the lease set") + } WorldGap::Other(s) => write!(f, "{s}"), } } @@ -419,9 +420,10 @@ mod tests { // The `From<&str>` arms exist so typing is incremental: a guard that is // genuinely just a sentence lands in Invariant/Other rather than // blocking the refactor. - assert!(matches!(Error::fail_closed("no aur_commit on the source identity"), - Error::FailClosed(Guard::Invariant(_)))); - assert!(matches!(Error::not_found("snapshot for build"), - Error::NotFound(Missing::Other(_)))); + assert!(matches!( + Error::fail_closed("no aur_commit on the source identity"), + Error::FailClosed(Guard::Invariant(_)) + )); + assert!(matches!(Error::not_found("snapshot for build"), Error::NotFound(Missing::Other(_)))); } } -- cgit v1.2.3