summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2021-12-21 19:57:12 -0500
committerJesse Luehrs <doy@tozt.net>2021-12-21 19:57:12 -0500
commitc043a9b39dad5b3a45e1ee61f65edc8d695755b6 (patch)
tree4b79f97a1ee867f990c2dfeb77dc62b3b97a37c8
parentefc9896da7901421b4e687d377e0cb75e2e99c2a (diff)
downloadadvent-of-code-c043a9b39dad5b3a45e1ee61f65edc8d695755b6.tar.gz
advent-of-code-c043a9b39dad5b3a45e1ee61f65edc8d695755b6.zip
use once_cell instead of lazy_static
-rw-r--r--Cargo.lock2
-rw-r--r--Cargo.toml2
-rw-r--r--src/regex.rs5
3 files changed, 4 insertions, 5 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 403b53b..02310cf 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -8,7 +8,7 @@ version = "0.1.0"
dependencies = [
"ahash",
"anyhow",
- "lazy_static",
+ "once_cell",
"paw",
"priority-queue",
"regex",
diff --git a/Cargo.toml b/Cargo.toml
index e863961..a673a01 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -9,7 +9,7 @@ edition = "2021"
[dependencies]
ahash = "0.7.6"
anyhow = "1.0.51"
-lazy_static = "1.4.0"
+once_cell = "1.9.0"
paw = "1.0.0"
priority-queue = "1.2.1"
regex = "1.5.4"
diff --git a/src/regex.rs b/src/regex.rs
index 56ce19f..12f8876 100644
--- a/src/regex.rs
+++ b/src/regex.rs
@@ -1,8 +1,7 @@
macro_rules! regex_captures {
($rx:expr, $s:expr $(,)?) => {{
- lazy_static::lazy_static! {
- static ref RX: Regex = regex::Regex::new($rx).unwrap();
- }
+ static RX: once_cell::sync::Lazy<regex::Regex> =
+ once_cell::sync::Lazy::new(|| regex::Regex::new($rx).unwrap());
RX.captures($s)
}};
}