mirror of
https://github.com/crate-ci/typos.git
synced 2024-12-26 09:32:11 -05:00
style: Address warnings
This commit is contained in:
parent
a177b1e624
commit
8804d1d2f4
3 changed files with 12 additions and 12 deletions
|
@ -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()
|
||||
};
|
||||
|
|
|
@ -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
|
||||
|
@ -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<Status<'s>> {
|
||||
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!(
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue