Skip to content

Commit

Permalink
fix: Don't check words if ident gets a hit
Browse files Browse the repository at this point in the history
  • Loading branch information
Ed Page committed Oct 25, 2019
1 parent a862991 commit ff8fce5
Showing 1 changed file with 28 additions and 26 deletions.
54 changes: 28 additions & 26 deletions typos/src/checks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,18 @@ impl<'d, 'p> Checks<'d, 'p> {
};
report(msg.into());
typos_found = true;
}
for word in ident.split() {
if let Some(correction) = self.dictionary.correct_word(word) {
let msg = report::FilenameCorrection {
path,
typo: word.token(),
correction,
non_exhaustive: (),
};
report(msg.into());
typos_found = true;
} else {
for word in ident.split() {
if let Some(correction) = self.dictionary.correct_word(word) {
let msg = report::FilenameCorrection {
path,
typo: word.token(),
correction,
non_exhaustive: (),
};
report(msg.into());
typos_found = true;
}
}
}
}
Expand Down Expand Up @@ -145,21 +146,22 @@ impl<'d, 'p> Checks<'d, 'p> {
};
typos_found = true;
report(msg.into());
}
for word in ident.split() {
if let Some(correction) = self.dictionary.correct_word(word) {
let col_num = word.offset();
let msg = report::Correction {
path,
line,
line_num,
col_num,
typo: word.token(),
correction,
non_exhaustive: (),
};
typos_found = true;
report(msg.into());
} else {
for word in ident.split() {
if let Some(correction) = self.dictionary.correct_word(word) {
let col_num = word.offset();
let msg = report::Correction {
path,
line,
line_num,
col_num,
typo: word.token(),
correction,
non_exhaustive: (),
};
typos_found = true;
report(msg.into());
}
}
}
}
Expand Down

0 comments on commit ff8fce5

Please sign in to comment.