Skip to content

Commit

Permalink
perf(dict): Skip checking numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
Ed Page committed Nov 12, 2020
1 parent d258e62 commit ce16d38
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/dict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit ce16d38

Please sign in to comment.