Skip to content

Commit fd6873b

Browse files
committed
refactor(cli): Make room for ident correction
1 parent b798780 commit fd6873b

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

crates/typos-cli/src/dict.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl BuiltIn {
3232

3333
let word = word_token.token();
3434
let word_case = unicase::UniCase::new(word);
35-
let mut corrections = if let Some(corrections) = self.correct_with_dict(word_case) {
35+
let mut corrections = if let Some(corrections) = self.correct_word_with_dict(word_case) {
3636
if corrections.is_empty() {
3737
Status::Invalid
3838
} else {
@@ -51,14 +51,20 @@ impl BuiltIn {
5151
#[cfg(feature = "dict")]
5252
impl BuiltIn {
5353
// Not using `Status` to avoid the allocations
54-
fn correct_with_dict(&self, word: unicase::UniCase<&str>) -> Option<&'static [&'static str]> {
54+
fn correct_word_with_dict(
55+
&self,
56+
word: unicase::UniCase<&str>,
57+
) -> Option<&'static [&'static str]> {
5558
typos_dict::WORD_TRIE.find(&word).copied()
5659
}
5760
}
5861

5962
#[cfg(not(feature = "dict"))]
6063
impl BuiltIn {
61-
fn correct_with_dict(&self, _word: unicase::UniCase<&str>) -> Option<&'static [&'static str]> {
64+
fn correct_word_with_dict(
65+
&self,
66+
_word: unicase::UniCase<&str>,
67+
) -> Option<&'static [&'static str]> {
6268
None
6369
}
6470
}

0 commit comments

Comments
 (0)