fix: Don't check words if ident gets a hit

This commit is contained in:
Ed Page 2019-10-25 14:58:08 -06:00
parent a8629916b4
commit ff8fce5fb6

View file

@ -88,17 +88,18 @@ impl<'d, 'p> Checks<'d, 'p> {
}; };
report(msg.into()); report(msg.into());
typos_found = true; typos_found = true;
} } else {
for word in ident.split() { for word in ident.split() {
if let Some(correction) = self.dictionary.correct_word(word) { if let Some(correction) = self.dictionary.correct_word(word) {
let msg = report::FilenameCorrection { let msg = report::FilenameCorrection {
path, path,
typo: word.token(), typo: word.token(),
correction, correction,
non_exhaustive: (), non_exhaustive: (),
}; };
report(msg.into()); report(msg.into());
typos_found = true; typos_found = true;
}
} }
} }
} }
@ -145,21 +146,22 @@ impl<'d, 'p> Checks<'d, 'p> {
}; };
typos_found = true; typos_found = true;
report(msg.into()); report(msg.into());
} } else {
for word in ident.split() { for word in ident.split() {
if let Some(correction) = self.dictionary.correct_word(word) { if let Some(correction) = self.dictionary.correct_word(word) {
let col_num = word.offset(); let col_num = word.offset();
let msg = report::Correction { let msg = report::Correction {
path, path,
line, line,
line_num, line_num,
col_num, col_num,
typo: word.token(), typo: word.token(),
correction, correction,
non_exhaustive: (), non_exhaustive: (),
}; };
typos_found = true; typos_found = true;
report(msg.into()); report(msg.into());
}
} }
} }
} }