mirror of
https://github.com/crate-ci/typos.git
synced 2024-12-23 08:02:15 -05:00
fix(dict): Handle cases from Linux
These were found while running `typos` on Linux and inspecting a sampling of the results. #249 represents additional changes to make. There were some identifiers, that looked like hardware registers, that I'm unsure of what can be done for them.
This commit is contained in:
parent
fb0dac4297
commit
639e65b88a
3 changed files with 33549 additions and 33551 deletions
5
crates/typos-dict/assets/words.csv
vendored
5
crates/typos-dict/assets/words.csv
vendored
|
@ -13021,7 +13021,6 @@ handelbars,handlebars
|
||||||
handicaped,handicapped
|
handicaped,handicapped
|
||||||
handwritng,handwriting
|
handwritng,handwriting
|
||||||
harasments,harassments
|
harasments,harassments
|
||||||
hardlinked,hardline
|
|
||||||
harmoniacs,harmonic
|
harmoniacs,harmonic
|
||||||
harmonisch,harmonic
|
harmonisch,harmonic
|
||||||
harrasment,harassment
|
harrasment,harassment
|
||||||
|
@ -23557,7 +23556,7 @@ referens,references
|
||||||
referere,referee
|
referere,referee
|
||||||
referign,refering
|
referign,refering
|
||||||
refering,referring
|
refering,referring
|
||||||
refernce,references
|
refernce,reference
|
||||||
reffered,referred
|
reffered,referred
|
||||||
refilles,refills
|
refilles,refills
|
||||||
refillls,refills
|
refillls,refills
|
||||||
|
@ -27976,7 +27975,7 @@ tast,taste
|
||||||
tath,that
|
tath,that
|
||||||
tehy,they
|
tehy,they
|
||||||
tghe,the
|
tghe,the
|
||||||
ther,there
|
ther,there,their,the
|
||||||
thge,the
|
thge,the
|
||||||
thna,than
|
thna,than
|
||||||
thne,then
|
thne,then
|
||||||
|
|
Can't render this file because it is too large.
|
File diff suppressed because it is too large
Load diff
10
src/dict.rs
10
src/dict.rs
|
@ -38,7 +38,7 @@ impl BuiltIn {
|
||||||
if corrections.is_empty() {
|
if corrections.is_empty() {
|
||||||
Status::Invalid
|
Status::Invalid
|
||||||
} else {
|
} else {
|
||||||
self.chain_with_vars(corrections)?
|
self.chain_with_vars(corrections)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
self.correct_with_vars(word)?
|
self.correct_with_vars(word)?
|
||||||
|
@ -65,7 +65,7 @@ impl BuiltIn {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "vars")]
|
#[cfg(feature = "vars")]
|
||||||
fn chain_with_vars(&self, corrections: &'static [&'static str]) -> Option<Status<'static>> {
|
fn chain_with_vars(&self, corrections: &'static [&'static str]) -> Status<'static> {
|
||||||
let mut chained: Vec<_> = corrections
|
let mut chained: Vec<_> = corrections
|
||||||
.iter()
|
.iter()
|
||||||
.flat_map(|c| match self.correct_with_vars(c) {
|
.flat_map(|c| match self.correct_with_vars(c) {
|
||||||
|
@ -81,12 +81,12 @@ impl BuiltIn {
|
||||||
chained.dedup();
|
chained.dedup();
|
||||||
}
|
}
|
||||||
debug_assert!(!chained.is_empty());
|
debug_assert!(!chained.is_empty());
|
||||||
Some(Status::Corrections(chained))
|
Status::Corrections(chained)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "vars"))]
|
#[cfg(not(feature = "vars"))]
|
||||||
fn chain_with_vars(&self, corrections: &[&str]) -> Option<Status<'static>> {
|
fn chain_with_vars(&self, corrections: &'static [&'static str]) -> Status<'static> {
|
||||||
Status::Corrections(corrections.map(|c| Cow::Borrowed(correction).collect()))
|
Status::Corrections(corrections.iter().map(|c| Cow::Borrowed(*c)).collect())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "vars")]
|
#[cfg(feature = "vars")]
|
||||||
|
|
Loading…
Reference in a new issue