refactor(cli): Make room for ident dict

This commit is contained in:
Ed Page 2023-09-25 12:42:18 -05:00
parent fd6873b6e0
commit 66a70abc40

View file

@ -20,9 +20,10 @@ impl BuiltIn {
pub fn correct_ident<'s>( pub fn correct_ident<'s>(
&'s self, &'s self,
_ident: typos::tokens::Identifier<'_>, ident_token: typos::tokens::Identifier<'_>,
) -> Option<Status<'s>> { ) -> Option<Status<'s>> {
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<Status<'s>> { pub fn correct_word<'s>(&'s self, word_token: typos::tokens::Word<'_>) -> Option<Status<'s>> {
@ -50,6 +51,10 @@ impl BuiltIn {
#[cfg(feature = "dict")] #[cfg(feature = "dict")]
impl BuiltIn { impl BuiltIn {
fn correct_ident_with_dict<'s>(&self, _ident: &str) -> Option<Status<'s>> {
None
}
// Not using `Status` to avoid the allocations // Not using `Status` to avoid the allocations
fn correct_word_with_dict( fn correct_word_with_dict(
&self, &self,
@ -61,6 +66,10 @@ impl BuiltIn {
#[cfg(not(feature = "dict"))] #[cfg(not(feature = "dict"))]
impl BuiltIn { impl BuiltIn {
fn correct_ident_with_dict<'s>(&self, _ident: &str) -> Option<Status<'s>> {
None
}
fn correct_word_with_dict( fn correct_word_with_dict(
&self, &self,
_word: unicase::UniCase<&str>, _word: unicase::UniCase<&str>,