From 243b1879346b307640e040472e199c52ada54bf9 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 27 Sep 2023 10:35:22 -0500 Subject: [PATCH] fix(cli): Properly fallback to built-in ident dict --- crates/typos-cli/src/dict.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/crates/typos-cli/src/dict.rs b/crates/typos-cli/src/dict.rs index 7f09952..57cb362 100644 --- a/crates/typos-cli/src/dict.rs +++ b/crates/typos-cli/src/dict.rs @@ -270,13 +270,12 @@ impl<'i, 'w, D: typos::Dictionary> typos::Dictionary for Override<'i, 'w, D> { // Skip hashing if we can if !self.identifiers.is_empty() { - self.identifiers - .get(ident.token()) - .map(|c| c.borrow()) - .or_else(|| self.inner.correct_ident(ident)) - } else { - None + if let Some(status) = self.identifiers.get(ident.token()).map(|c| c.borrow()) { + return Some(status); + } } + + self.inner.correct_ident(ident) } fn correct_word<'s>(&'s self, word: typos::tokens::Word<'_>) -> Option> {