Skip to content

Commit

Permalink
style: Address warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed May 2, 2024
1 parent a177b1e commit 8804d1d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion crates/typos-cli/src/bin/typos-cli/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
};
Expand Down
18 changes: 9 additions & 9 deletions crates/typos-cli/src/dict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ impl BuiltIn {
}

pub fn correct_word<'s>(&'s self, word_token: typos::tokens::Word<'_>) -> Option<Status<'s>> {
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
Expand Down Expand Up @@ -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) => {
Expand Down Expand Up @@ -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<Status<'s>> {
if word_token.case() == typos::tokens::Case::None {
if word_token.case() == Case::None {
return None;
}

Expand Down Expand Up @@ -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!(
Expand All @@ -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);
Expand All @@ -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));
Expand All @@ -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!(
Expand All @@ -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!(
Expand Down
4 changes: 2 additions & 2 deletions crates/typos-dict/tests/verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ fn process<S: Into<String>>(
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);
}
Expand Down Expand Up @@ -196,7 +196,7 @@ fn varcon_words() -> HashSet<UniCase<&'static str>> {
.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()
}

Expand Down

0 comments on commit 8804d1d

Please sign in to comment.