From ce16d38cfd852302696c4e2aed34fb08c1890346 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 11 Nov 2020 18:24:51 -0600 Subject: [PATCH] perf(dict): Skip checking numbers --- src/dict.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/dict.rs b/src/dict.rs index a6993d6..ab602d6 100644 --- a/src/dict.rs +++ b/src/dict.rs @@ -29,6 +29,10 @@ impl BuiltIn { &'s self, word_token: typos::tokens::Word<'w>, ) -> Option> { + 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> { + 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());