From 66a70abc406e524294ab5a93b5fc5e40ca93cabb Mon Sep 17 00:00:00 2001 From: Ed Page Date: Mon, 25 Sep 2023 12:42:18 -0500 Subject: [PATCH] refactor(cli): Make room for ident dict --- crates/typos-cli/src/dict.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/crates/typos-cli/src/dict.rs b/crates/typos-cli/src/dict.rs index 8a2c0fe..33ea70d 100644 --- a/crates/typos-cli/src/dict.rs +++ b/crates/typos-cli/src/dict.rs @@ -20,9 +20,10 @@ impl BuiltIn { pub fn correct_ident<'s>( &'s self, - _ident: typos::tokens::Identifier<'_>, + ident_token: typos::tokens::Identifier<'_>, ) -> Option> { - None + let ident = ident_token.token(); + self.correct_ident_with_dict(ident) } pub fn correct_word<'s>(&'s self, word_token: typos::tokens::Word<'_>) -> Option> { @@ -50,6 +51,10 @@ impl BuiltIn { #[cfg(feature = "dict")] impl BuiltIn { + fn correct_ident_with_dict<'s>(&self, _ident: &str) -> Option> { + None + } + // Not using `Status` to avoid the allocations fn correct_word_with_dict( &self, @@ -61,6 +66,10 @@ impl BuiltIn { #[cfg(not(feature = "dict"))] impl BuiltIn { + fn correct_ident_with_dict<'s>(&self, _ident: &str) -> Option> { + None + } + fn correct_word_with_dict( &self, _word: unicase::UniCase<&str>,