diff options
author | Jesse Luehrs <doy@tozt.net> | 2021-12-21 19:57:12 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2021-12-21 19:57:12 -0500 |
commit | c043a9b39dad5b3a45e1ee61f65edc8d695755b6 (patch) | |
tree | 4b79f97a1ee867f990c2dfeb77dc62b3b97a37c8 | |
parent | efc9896da7901421b4e687d377e0cb75e2e99c2a (diff) | |
download | advent-of-code-c043a9b39dad5b3a45e1ee61f65edc8d695755b6.tar.gz advent-of-code-c043a9b39dad5b3a45e1ee61f65edc8d695755b6.zip |
use once_cell instead of lazy_static
-rw-r--r-- | Cargo.lock | 2 | ||||
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | src/regex.rs | 5 |
3 files changed, 4 insertions, 5 deletions
@@ -8,7 +8,7 @@ version = "0.1.0" dependencies = [ "ahash", "anyhow", - "lazy_static", + "once_cell", "paw", "priority-queue", "regex", @@ -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) }}; } |