mirror of
https://github.com/crate-ci/typos.git
synced 2026-10-18 01:45:12 +02:00
fix(dict): Ensure we fall through to built-in dict
This commit is contained in:
+4
-6
@@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user