Skip to content

Commit 1a3ce2b

Browse files
authored
Merge pull request #836 from epage/ident
fix(cli): Properly fallback to built-in ident dict
2 parents f301320 + 243b187 commit 1a3ce2b

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

crates/typos-cli/src/dict.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -270,13 +270,12 @@ impl<'i, 'w, D: typos::Dictionary> typos::Dictionary for Override<'i, 'w, D> {
270270

271271
// Skip hashing if we can
272272
if !self.identifiers.is_empty() {
273-
self.identifiers
274-
.get(ident.token())
275-
.map(|c| c.borrow())
276-
.or_else(|| self.inner.correct_ident(ident))
277-
} else {
278-
None
273+
if let Some(status) = self.identifiers.get(ident.token()).map(|c| c.borrow()) {
274+
return Some(status);
275+
}
279276
}
277+
278+
self.inner.correct_ident(ident)
280279
}
281280

282281
fn correct_word<'s>(&'s self, word: typos::tokens::Word<'_>) -> Option<Status<'s>> {

0 commit comments

Comments
 (0)