fix(cli): Properly fallback to built-in ident dict

This commit is contained in:
Ed Page 2023-09-27 10:35:22 -05:00
parent f301320d47
commit 243b187934

View file

@ -270,15 +270,14 @@ impl<'i, 'w, D: typos::Dictionary> typos::Dictionary for Override<'i, 'w, D> {
// Skip hashing if we can // Skip hashing if we can
if !self.identifiers.is_empty() { if !self.identifiers.is_empty() {
self.identifiers if let Some(status) = self.identifiers.get(ident.token()).map(|c| c.borrow()) {
.get(ident.token()) return Some(status);
.map(|c| c.borrow())
.or_else(|| self.inner.correct_ident(ident))
} else {
None
} }
} }
self.inner.correct_ident(ident)
}
fn correct_word<'s>(&'s self, word: typos::tokens::Word<'_>) -> Option<Status<'s>> { fn correct_word<'s>(&'s self, word: typos::tokens::Word<'_>) -> Option<Status<'s>> {
if word.case() == typos::tokens::Case::None { if word.case() == typos::tokens::Case::None {
return None; return None;