mirror of
https://github.com/crate-ci/typos.git
synced 2024-11-21 16:41:01 -05:00
refactor: Move off of lazy_static
This commit is contained in:
parent
3bcd8a130e
commit
97f90da9bc
3 changed files with 18 additions and 12 deletions
8
Cargo.lock
generated
8
Cargo.lock
generated
|
@ -523,6 +523,12 @@ dependencies = [
|
|||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "260e51e7efe62b592207e9e13a68e43692a7a279171d6ba57abd208bf23645ad"
|
||||
|
||||
[[package]]
|
||||
name = "phf"
|
||||
version = "0.8.0"
|
||||
|
@ -982,8 +988,8 @@ dependencies = [
|
|||
"derive_more 0.99.11",
|
||||
"derive_setters",
|
||||
"itertools",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"once_cell",
|
||||
"regex",
|
||||
"serde",
|
||||
"serde_json",
|
||||
|
|
|
@ -18,7 +18,7 @@ codecov = { repository = "crate-ci/typos" }
|
|||
anyhow = "1.0"
|
||||
thiserror = "1.0"
|
||||
regex = "1.3"
|
||||
lazy_static = "1.2.0"
|
||||
once_cell = "1.2.0"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
itertools = "0.9"
|
||||
|
|
|
@ -138,21 +138,21 @@ impl Default for Parser {
|
|||
}
|
||||
}
|
||||
|
||||
fn is_number(ident: &[u8]) -> bool {
|
||||
lazy_static::lazy_static! {
|
||||
// `_`: number literal separator in Rust and other languages
|
||||
// `'`: number literal separator in C++
|
||||
static ref DIGITS: regex::bytes::Regex = regex::bytes::Regex::new(r#"^[0-9_']+$"#).unwrap();
|
||||
}
|
||||
static DIGITS: once_cell::sync::Lazy<regex::bytes::Regex> =
|
||||
once_cell::sync::Lazy::new(|| regex::bytes::Regex::new(r#"^[0-9_']+$"#).unwrap());
|
||||
|
||||
fn is_number(ident: &[u8]) -> bool {
|
||||
DIGITS.is_match(ident)
|
||||
}
|
||||
|
||||
fn is_hex(ident: &[u8]) -> bool {
|
||||
lazy_static::lazy_static! {
|
||||
// `_`: number literal separator in Rust and other languages
|
||||
// `'`: number literal separator in C++
|
||||
static ref HEX: regex::bytes::Regex = regex::bytes::Regex::new(r#"^0[xX][0-9a-fA-F_']+$"#).unwrap();
|
||||
}
|
||||
static HEX: once_cell::sync::Lazy<regex::bytes::Regex> =
|
||||
once_cell::sync::Lazy::new(|| regex::bytes::Regex::new(r#"^0[xX][0-9a-fA-F_']+$"#).unwrap());
|
||||
|
||||
fn is_hex(ident: &[u8]) -> bool {
|
||||
HEX.is_match(ident)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue