From 8804d1d2f4ee7f5672e9660a13444f80f34fadfb Mon Sep 17 00:00:00 2001 From: Ed Page Date: Thu, 2 May 2024 11:59:32 -0500 Subject: [PATCH] style: Address warnings --- crates/typos-cli/src/bin/typos-cli/main.rs | 2 +- crates/typos-cli/src/dict.rs | 18 +++++++++--------- crates/typos-dict/tests/verify.rs | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/crates/typos-cli/src/bin/typos-cli/main.rs b/crates/typos-cli/src/bin/typos-cli/main.rs index fbf505a..a63af80 100644 --- a/crates/typos-cli/src/bin/typos-cli/main.rs +++ b/crates/typos-cli/src/bin/typos-cli/main.rs @@ -266,7 +266,7 @@ fn run_checks(args: &args::Args) -> proc_exit::ExitResult { // HACK: Diff doesn't handle mixing content let output_reporter = if args.diff { - Box::new(crate::report::PrintSilent) + Box::new(report::PrintSilent) } else { args.format.reporter() }; diff --git a/crates/typos-cli/src/dict.rs b/crates/typos-cli/src/dict.rs index a8b0690..ab6d70d 100644 --- a/crates/typos-cli/src/dict.rs +++ b/crates/typos-cli/src/dict.rs @@ -27,12 +27,12 @@ impl BuiltIn { } pub fn correct_word<'s>(&'s self, word_token: typos::tokens::Word<'_>) -> Option> { - if word_token.case() == typos::tokens::Case::None { + if word_token.case() == Case::None { return None; } let word = word_token.token(); - let word_case = unicase::UniCase::new(word); + let word_case = UniCase::new(word); let mut corrections = if let Some(corrections) = self.correct_word_with_dict(word_case) { if corrections.is_empty() { Status::Invalid @@ -85,7 +85,7 @@ impl BuiltIn { if self.is_vars_enabled() { let mut chained: Vec<_> = corrections .iter() - .flat_map(|c| match self.correct_with_vars(unicase::UniCase::new(c)) { + .flat_map(|c| match self.correct_with_vars(UniCase::new(c)) { Some(Status::Valid) | None => vec![Cow::Borrowed(*c)], Some(Status::Corrections(vars)) => vars, Some(Status::Invalid) => { @@ -283,7 +283,7 @@ impl<'i, 'w, D: typos::Dictionary> typos::Dictionary for Override<'i, 'w, D> { } fn correct_word<'s>(&'s self, word_token: typos::tokens::Word<'_>) -> Option> { - if word_token.case() == typos::tokens::Case::None { + if word_token.case() == Case::None { return None; } @@ -319,7 +319,7 @@ mod test { let dict = BuiltIn::new(crate::config::Locale::default()); let correction = dict.correct_word(typos::tokens::Word::new_unchecked( "finallizes", - typos::tokens::Case::Lower, + Case::Lower, 0, )); assert_eq!( @@ -334,7 +334,7 @@ mod test { let dict = BuiltIn::new(crate::config::Locale::En); let correction = dict.correct_word(typos::tokens::Word::new_unchecked( "finalizes", - typos::tokens::Case::Lower, + Case::Lower, 0, )); assert_eq!(correction, None); @@ -346,7 +346,7 @@ mod test { let dict = BuiltIn::new(crate::config::Locale::EnUs); let correction = dict.correct_word(typos::tokens::Word::new_unchecked( "finalizes", - typos::tokens::Case::Lower, + Case::Lower, 0, )); assert_eq!(correction, Some(Status::Valid)); @@ -358,7 +358,7 @@ mod test { let dict = BuiltIn::new(crate::config::Locale::EnGb); let correction = dict.correct_word(typos::tokens::Word::new_unchecked( "finalizes", - typos::tokens::Case::Lower, + Case::Lower, 0, )); assert_eq!( @@ -373,7 +373,7 @@ mod test { let dict = BuiltIn::new(crate::config::Locale::EnGb); let correction = dict.correct_word(typos::tokens::Word::new_unchecked( "finallizes", - typos::tokens::Case::Lower, + Case::Lower, 0, )); assert_eq!( diff --git a/crates/typos-dict/tests/verify.rs b/crates/typos-dict/tests/verify.rs index f5f5bbd..64fd15f 100644 --- a/crates/typos-dict/tests/verify.rs +++ b/crates/typos-dict/tests/verify.rs @@ -91,7 +91,7 @@ fn process>( let rows: Vec<_> = rows .into_iter() .filter(|(typo, _)| { - let is_disallowed = varcon_words.contains(&unicase::UniCase::new(typo)); + let is_disallowed = varcon_words.contains(&UniCase::new(typo)); if is_disallowed { eprintln!("{:?} is disallowed; in varcon", typo); } @@ -196,7 +196,7 @@ fn varcon_words() -> HashSet> { .iter() .flat_map(|c| c.entries.iter()) .flat_map(|e| e.variants.iter()) - .map(|v| unicase::UniCase::new(v.word)) + .map(|v| UniCase::new(v.word)) .collect() }