mirror of
https://github.com/crate-ci/typos.git
synced 2024-11-22 00:51:11 -05:00
feat(parser): Treat contractions as a word
This should be safe. Rarely is `'` used as syntax in a language that separates literals. - `'` is used within hex literals in C++ but we want to treat them as one word - `'` is used for lifetimes in Rust but there are other symbols on the left side.
This commit is contained in:
parent
006204e66a
commit
b6ab968478
1 changed files with 1 additions and 1 deletions
|
@ -42,7 +42,7 @@ impl<'t> Identifier<'t> {
|
||||||
lazy_static::lazy_static! {
|
lazy_static::lazy_static! {
|
||||||
// Getting false positives for this lint
|
// Getting false positives for this lint
|
||||||
#[allow(clippy::invalid_regex)]
|
#[allow(clippy::invalid_regex)]
|
||||||
static ref SPLIT: regex::bytes::Regex = regex::bytes::Regex::new(r#"\b(\p{Alphabetic}|\d|_)+\b"#).unwrap();
|
static ref SPLIT: regex::bytes::Regex = regex::bytes::Regex::new(r#"\b(\p{Alphabetic}|\d|_|')+\b"#).unwrap();
|
||||||
}
|
}
|
||||||
SPLIT.find_iter(content).filter_map(|m| {
|
SPLIT.find_iter(content).filter_map(|m| {
|
||||||
let s = std::str::from_utf8(m.as_bytes()).ok();
|
let s = std::str::from_utf8(m.as_bytes()).ok();
|
||||||
|
|
Loading…
Reference in a new issue