mirror of
https://github.com/crate-ci/typos.git
synced 2024-12-23 08:02:15 -05:00
fix(dict): Ensure we fall through to built-in dict
This commit is contained in:
parent
36709b6f37
commit
482d320407
1 changed files with 4 additions and 6 deletions
10
src/dict.rs
10
src/dict.rs
|
@ -212,16 +212,14 @@ 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>> {
|
||||
// Skip hashing if we can
|
||||
if !self.words.is_empty() {
|
||||
let custom = if !self.words.is_empty() {
|
||||
let w = UniCase::new(word.token());
|
||||
// HACK: couldn't figure out the lifetime issue with replacing `cloned` with `borrow`
|
||||
self.words
|
||||
.get(&w)
|
||||
.cloned()
|
||||
.or_else(|| self.inner.correct_word(word))
|
||||
self.words.get(&w).cloned()
|
||||
} else {
|
||||
None
|
||||
}
|
||||
};
|
||||
custom.or_else(|| self.inner.correct_word(word))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue