Skip to content

Commit

Permalink
replace lazy_static with lazylock
Browse files Browse the repository at this point in the history
  • Loading branch information
tiye committed Nov 22, 2024
1 parent dadbc96 commit 967a6e5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ path = "src/bin/cli.rs"
[dependencies]
cirru_parser = "0.1.31"
regex = "1.10.5"
lazy_static = "1.5.0"
bincode = "2.0.0-rc.3"
argh = "0.1.12"

Expand Down
11 changes: 4 additions & 7 deletions src/calx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ mod types;

// use bincode::{Decode, Encode};
use core::fmt;
use lazy_static::lazy_static;
use regex::Regex;
use std::{rc::Rc, str::FromStr};
use std::{rc::Rc, str::FromStr, sync::LazyLock};

pub use types::CalxType;

Expand Down Expand Up @@ -111,8 +110,6 @@ impl fmt::Display for Calx {
}
}

lazy_static! {
static ref FLOAT_PATTERN: Regex = Regex::new("^-?\\d+\\.(\\d+)?$").unwrap();
static ref INT_PATTERN: Regex = Regex::new("^-?\\d+$").unwrap();
static ref USIZE_PATTERN: Regex = Regex::new("^\\d+$").unwrap();
}
static FLOAT_PATTERN: LazyLock<Regex> = LazyLock::new(|| Regex::new("^-?\\d+\\.(\\d+)?$").unwrap());
static INT_PATTERN: LazyLock<Regex> = LazyLock::new(|| Regex::new("^-?\\d+$").unwrap());
// static USIZE_PATTERN: LazyLock<Regex> = LazyLock::new(|| Regex::new("^\\d+$").unwrap());

0 comments on commit 967a6e5

Please sign in to comment.