From 28d7dfa48febcc36601bf56f890abf62a3a3990d 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 1224998 -> 1224998 bytes src/lib.rs | 34 ++++++++++++++++++++++++---------- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/module.wasm b/module.wasm index 185a950a4e6303d8e58df407de5c9ef2aa47b7c2..68409ec2fbce4335d8e3b237af32d2918b454741 100644 GIT binary patch delta 205 zcmZ4X$ZOdnuZ9-J7N!>F7M2#)7Pc1l7LFFq7OocV7M>Q~7QPn#7J)5-jxwGR3=9lf zKF7M2#)7Pc1l7LFFq7OocV7M>Q~7QPn#7J)5-jxwH+3=9lf zK Result { .require_json("norm") .map_err(|e| ModuleError::invalid_input(format!("norm shape: {e}")))?; - let re_para = Regex::new(r"§\s*(\d+[a-z]?)\s+([A-Z][A-Za-z0-9]+)") - .map_err(internal_re)?; - let re_art = Regex::new(r"Art(?:ikel|\.)\s*(\d+[a-z]?)\s+([A-Z][A-Za-z0-9]+)") - .map_err(internal_re)?; - let re_ivm = Regex::new(r"i\.\s?V\.\s?m\.\s+(?:§|Art\.?)\s*(\d+[a-z]?)") - .map_err(internal_re)?; + let re_para = Regex::new(r"§\s*(\d+[a-z]?)\s+([A-Z][A-Za-z0-9]+)").map_err(internal_re)?; + let re_art = + Regex::new(r"Art(?:ikel|\.)\s*(\d+[a-z]?)\s+([A-Z][A-Za-z0-9]+)").map_err(internal_re)?; + let re_ivm = + Regex::new(r"i\.\s?V\.\s?m\.\s+(?:§|Art\.?)\s*(\d+[a-z]?)").map_err(internal_re)?; let from_eli = norm.eli.unwrap_or_else(|| "eli/?".into()); let mut citations = Vec::new(); @@ -93,7 +92,10 @@ pub fn invoke(_ctx: Context, inputs: Inputs) -> Result { } } - let out = Output { from: from_eli, citations }; + let out = Output { + from: from_eli, + citations, + }; Outputs::new().with_json("citations", &out) } @@ -103,6 +105,7 @@ fn internal_re(e: E) -> ModuleError { #[cfg(test)] mod tests { + #![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)] use super::*; use regex::Regex; @@ -114,20 +117,31 @@ mod tests { for p in &norm.paragraphs { for c in re_para.captures_iter(&p.text) { cs.push(Citation { - to: format!("eli/bund/{}/{}", c[2].to_ascii_lowercase(), c[1].to_ascii_lowercase()), + to: format!( + "eli/bund/{}/{}", + c[2].to_ascii_lowercase(), + c[1].to_ascii_lowercase() + ), kind: "cites", raw: c[0].to_string(), }); } for c in re_art.captures_iter(&p.text) { cs.push(Citation { - to: format!("eli/eu/{}/art{}", c[2].to_ascii_lowercase(), c[1].to_ascii_lowercase()), + to: format!( + "eli/eu/{}/art{}", + c[2].to_ascii_lowercase(), + c[1].to_ascii_lowercase() + ), kind: "cites", raw: c[0].to_string(), }); } } - Output { from: norm.eli.unwrap_or_default(), citations: cs } + Output { + from: norm.eli.unwrap_or_default(), + citations: cs, + } } #[test]