mirror of
https://github.com/crate-ci/typos.git
synced 2025-01-10 16:54:51 -05:00
perf(dict): Skip checking numbers
This commit is contained in:
parent
d258e62f43
commit
ce16d38cfd
1 changed files with 8 additions and 0 deletions
|
@ -29,6 +29,10 @@ impl BuiltIn {
|
|||
&'s self,
|
||||
word_token: typos::tokens::Word<'w>,
|
||||
) -> Option<Status<'s>> {
|
||||
if word_token.case() == typos::tokens::Case::None {
|
||||
return None;
|
||||
}
|
||||
|
||||
let word = word_token.token();
|
||||
let mut corrections = if let Some(correction) = self.correct_with_dict(word) {
|
||||
self.correct_with_vars(word)
|
||||
|
@ -211,6 +215,10 @@ impl<'i, 'w, D: typos::Dictionary> typos::Dictionary for Override<'i, 'w, D> {
|
|||
}
|
||||
|
||||
fn correct_word<'s, 't>(&'s self, word: typos::tokens::Word<'t>) -> Option<Status<'s>> {
|
||||
if word.case() == typos::tokens::Case::None {
|
||||
return None;
|
||||
}
|
||||
|
||||
// Skip hashing if we can
|
||||
let custom = if !self.words.is_empty() {
|
||||
let w = UniCase::new(word.token());
|
||||
|
|
Loading…
Reference in a new issue