From f85a7eaa66693fc8a3881cc5cbb3218aac3c2bd4 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Tue, 5 Mar 2024 05:03:56 -0600 Subject: [PATCH] Apply clippy fixes --- zspell-cli/src/download.rs | 1 + zspell/src/dict.rs | 2 +- zspell/src/dict/meta.rs | 2 +- zspell/src/dict/rule.rs | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/zspell-cli/src/download.rs b/zspell-cli/src/download.rs index d3113cb..6a4e51a 100644 --- a/zspell-cli/src/download.rs +++ b/zspell-cli/src/download.rs @@ -113,6 +113,7 @@ fn open_new_file(path: &Path, overwrite: bool) -> anyhow::Result { .write(true) .read(true) .create(true) + .truncate(true) .open(path) .context(format!("unable to open '{fname}' in '{dir}'")) } else { diff --git a/zspell/src/dict.rs b/zspell/src/dict.rs index 1f3486f..83e3635 100644 --- a/zspell/src/dict.rs +++ b/zspell/src/dict.rs @@ -303,7 +303,7 @@ impl Dictionary { let mut nosuggest = false; for flag in flags { - if self.affix_flags.get(flag).is_none() { + if self.affix_flags.contains_key(flag) { // FIXME: we get stuck on compound rules continue; } diff --git a/zspell/src/dict/meta.rs b/zspell/src/dict/meta.rs index 88a0f32..863e143 100644 --- a/zspell/src/dict/meta.rs +++ b/zspell/src/dict/meta.rs @@ -55,7 +55,7 @@ pub enum Source { /// The full rule that created this rule: Arc, /// Index of the relevant pattern within the rule. This could potentially be a reference - /// but that might require a RefCell, and I don't want to risk reference + /// but that might require a `RefCell`, and I don't want to risk reference pat_idx: usize, }, /// This meta came from a .dic file, only contains morphinfo diff --git a/zspell/src/dict/rule.rs b/zspell/src/dict/rule.rs index 12a9871..88b398f 100644 --- a/zspell/src/dict/rule.rs +++ b/zspell/src/dict/rule.rs @@ -58,7 +58,7 @@ impl AfxRule { ret.patterns.push(AfxRulePattern { affix: rule.affix.as_str().into(), condition: rule.condition.clone(), - strip: rule.strip.as_ref().map(Arc::clone), + strip: rule.strip.clone(), morph_info, }); }