fix(clippy): bring source under -D warnings ahead of CI

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 <sf@flemming.it>
This commit is contained in:
flemming-it 2026-06-18 12:13:11 +02:00
parent 6e7c568137
commit 1e0a581cf4
2 changed files with 17 additions and 6 deletions

Binary file not shown.

View file

@ -57,9 +57,7 @@ pub fn invoke(_ctx: Context, inputs: Inputs) -> Result<Outputs, ModuleError> {
for d in &input.duties { for d in &input.duties {
if d.frequency < 0.0 || d.tariff_eur_per_hour < 0.0 || d.time_hours_per_case < 0.0 { if d.frequency < 0.0 || d.tariff_eur_per_hour < 0.0 || d.time_hours_per_case < 0.0 {
return Err(ModuleError::invalid_input( return Err(ModuleError::invalid_input("negative P/F/T/h not allowed"));
"negative P/F/T/h not allowed",
));
} }
let value = d.population as f64 let value = d.population as f64
* d.frequency as f64 * d.frequency as f64
@ -84,7 +82,11 @@ pub fn invoke(_ctx: Context, inputs: Inputs) -> Result<Outputs, ModuleError> {
total += value; 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) Outputs::new().with_json("report", &r)
} }
@ -97,11 +99,16 @@ fn lower_tier(a: &str, b: &str) -> String {
"T3" => 3, "T3" => 3,
_ => 4, _ => 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)] #[cfg(test)]
mod tests { mod tests {
#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
use super::*; use super::*;
#[test] #[test]
@ -155,6 +162,10 @@ mod tests {
tier: t, tier: t,
}); });
} }
Ok(Report { items, total_eur_per_year: total, tier_lowest: tier }) Ok(Report {
items,
total_eur_per_year: total,
tier_lowest: tier,
})
} }
} }