From 1e0a581cf42eee2af34242c77fa0c4a93010dbc4 Mon Sep 17 00:00:00 2001 From: flemming-it Date: Thu, 18 Jun 2026 12:13:11 +0200 Subject: [PATCH] fix(clippy): bring source under -D warnings ahead of CI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prep for the Forgejo CI gate. Adjustments per module are small and local: - test modules get inner `#![allow(clippy::unwrap_used, expect_used, panic)]` so the existing assert.expect() test idiom keeps working without rewriting every fixture - the dead_code field that downstream consumers may still want serialised gets an explicit #[allow(dead_code)] - manual char/range comparisons fold to the idiomatic forms (`['…']`, `(2..=5).contains(&n)`) - one snake_case rename in text-readability-score Also re-bakes module.wasm so the committed artefact matches the post-fmt source byte-for-byte. No behaviour change, no test change. cargo fmt --all -- --check and cargo clippy --all-targets -- -D warnings now both pass. Signed-off-by: flemming-it --- module.wasm | Bin 175437 -> 175437 bytes src/lib.rs | 23 +++++++++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/module.wasm b/module.wasm index edf544bae8730b7ba249a956f545c09b5de011af..d459b089dbc0887d2800582a97404761758e7028 100644 GIT binary patch delta 21 dcmX?mi|gzyu7(!IElk(q7=5;1k7FwH0|0P#2~hw5 delta 21 dcmX?mi|gzyu7(!IElk(q82z?ik7FwH0|0P@2~z+7 diff --git a/src/lib.rs b/src/lib.rs index 3b25040..11a1e28 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -57,9 +57,7 @@ pub fn invoke(_ctx: Context, inputs: Inputs) -> Result { for d in &input.duties { if d.frequency < 0.0 || d.tariff_eur_per_hour < 0.0 || d.time_hours_per_case < 0.0 { - return Err(ModuleError::invalid_input( - "negative P/F/T/h not allowed", - )); + return Err(ModuleError::invalid_input("negative P/F/T/h not allowed")); } let value = d.population as f64 * d.frequency as f64 @@ -84,7 +82,11 @@ pub fn invoke(_ctx: Context, inputs: Inputs) -> Result { total += value; } - let r = Report { items, total_eur_per_year: total, tier_lowest }; + let r = Report { + items, + total_eur_per_year: total, + tier_lowest, + }; Outputs::new().with_json("report", &r) } @@ -97,11 +99,16 @@ fn lower_tier(a: &str, b: &str) -> String { "T3" => 3, _ => 4, }; - if rank(b) > rank(a) { b.to_string() } else { a.to_string() } + if rank(b) > rank(a) { + b.to_string() + } else { + a.to_string() + } } #[cfg(test)] mod tests { + #![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)] use super::*; #[test] @@ -155,6 +162,10 @@ mod tests { tier: t, }); } - Ok(Report { items, total_eur_per_year: total, tier_lowest: tier }) + Ok(Report { + items, + total_eur_per_year: total, + tier_lowest: tier, + }) } }