mirror of
https://github.com/crate-ci/typos.git
synced 2025-02-13 08:40:29 -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,
|
&'s self,
|
||||||
word_token: typos::tokens::Word<'w>,
|
word_token: typos::tokens::Word<'w>,
|
||||||
) -> Option<Status<'s>> {
|
) -> Option<Status<'s>> {
|
||||||
|
if word_token.case() == typos::tokens::Case::None {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
let word = word_token.token();
|
let word = word_token.token();
|
||||||
let mut corrections = if let Some(correction) = self.correct_with_dict(word) {
|
let mut corrections = if let Some(correction) = self.correct_with_dict(word) {
|
||||||
self.correct_with_vars(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>> {
|
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
|
// Skip hashing if we can
|
||||||
let custom = if !self.words.is_empty() {
|
let custom = if !self.words.is_empty() {
|
||||||
let w = UniCase::new(word.token());
|
let w = UniCase::new(word.token());
|
||||||
|
|
Loading…
Add table
Reference in a new issue