From ab30d379973041b93a3bc7de15c5cf00d58df27c Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sat, 24 Oct 2026 03:54:19 -0400 Subject: [PATCH] chore: resolve SonarCloud maintainability issues (storytold/wordcraft#4083) * chore: resolve SonarCloud maintainability issues * fix: restore compiling refactors, revert behaviour changes, run cargo fmt - fontdb::norm: keep the closure for filter (char::is_alphanumeric takes self, not &self, so it does not fit Iterator::filter). - story.rs: write_mark_rpr needs &mut self (rev_attrs, rpr_change). - Revert the viewport meta change and the return 0 added to workspace_version/sha256, which changed behaviour or masked failures. - cargo fmt. Co-Authored-By: Claude Opus 5.5 * Import Document in odt page_parts after dropping glob re-export * fix: apply_kind_properties binds ContentControl; cell_ref keeps char closures * fix(engine): pass case helpers by value (clippy needless borrows) --------- Co-authored-by: Claude Opus 5.5 Co-authored-by: Dylan Taylor --- crates/proof/src/it/grammar.rs | 2 +- crates/proof/src/lib.rs | 4 ++-- crates/proof/src/ru/mod.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/proof/src/it/grammar.rs b/crates/proof/src/it/grammar.rs index 235012bd..46302936 100644 --- a/crates/proof/src/it/grammar.rs +++ b/crates/proof/src/it/grammar.rs @@ -276,7 +276,7 @@ fn e_apostrophe(text: &str, ws: &[(usize, usize)], v: &mut Vec) { } let mut after = text.get(*b..).unwrap_or("").chars(); let Some(ap) = after.next().filter(|&c| is_apostrophe(c)) else { continue }; - let ends = after.next().is_none_or(|c| c.is_whitespace()); + let ends = after.next().is_none_or(char::is_whitespace); let quoted = text.get(..*a).and_then(|t| t.chars().next_back()).is_some_and(|c| is_apostrophe(c) || c == '‘'); if ends && !quoted { v.push(issue(*a, *b + ap.len_utf8(), "«È» si scrive con l'accento, non con l'apostrofo".into(), vec!["È".into()])); diff --git a/crates/proof/src/lib.rs b/crates/proof/src/lib.rs index 0ab16529..38f274c7 100644 --- a/crates/proof/src/lib.rs +++ b/crates/proof/src/lib.rs @@ -320,7 +320,7 @@ const COMMON: &str = "a an the and or but if of to in on at by for with from as const EXTRA_EN: &str = include_str!("../../../assets/spelling/en-extra.txt"); fn extra_words() -> &'static HashSet<&'static str> { - static E: OnceLock> = OnceLock::new(); + static E: OnceLock> = OnceLock::new(); E.get_or_init(|| EXTRA_EN.lines().map(str::trim).filter(|l| !l.is_empty() && !l.starts_with('#')).collect()) } @@ -889,7 +889,7 @@ fn grammar_en(text: &str, capital_first: bool) -> Vec { if gap == " " && (w0 == "an" || w0 == "An") && w1.chars().next().is_some_and(|c| c.is_alphabetic() && !"aeiouAEIOUhH".contains(c)) - && !w1.chars().all(|c| c.is_uppercase()) + && !w1.chars().all(char::is_uppercase) { v.push(Issue { start: *a0, diff --git a/crates/proof/src/ru/mod.rs b/crates/proof/src/ru/mod.rs index c29bbc7c..50faac38 100644 --- a/crates/proof/src/ru/mod.rs +++ b/crates/proof/src/ru/mod.rs @@ -109,7 +109,7 @@ pub fn has_dictionary() -> bool { /// Is `c` a letter of the Cyrillic script (the only one the Russian dictionary covers)? pub(crate) fn is_cyrillic(c: char) -> bool { - matches!(c, '\u{0400}'..='\u{04FF}' | '\u{0500}'..='\u{052F}') + matches!(c, '\u{0400}'..='\u{052F}') } /// Particles joined to a word with a hyphen (`кто-то`, `где-нибудь`, `давай-ка`, `всё-таки`,