diff --git a/Cargo.toml b/Cargo.toml index a8cb94a..bb2f819 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -129,7 +129,6 @@ rusqlite-macros = { path = "rusqlite-macros", version = "0.3.0", optional = true [dev-dependencies] doc-comment = "0.3" tempfile = "3.1.0" -lazy_static = "1.4" regex = "1.5.5" uuid = { version = "1.0", features = ["v4"] } unicase = "2.6.0" diff --git a/src/trace.rs b/src/trace.rs index c070c35..c728dfa 100644 --- a/src/trace.rs +++ b/src/trace.rs @@ -122,17 +122,15 @@ impl Connection { #[cfg(test)] mod test { - use lazy_static::lazy_static; - use std::sync::Mutex; + use std::sync::{LazyLock, Mutex}; use std::time::Duration; use crate::{Connection, Result}; #[test] fn test_trace() -> Result<()> { - lazy_static! { - static ref TRACED_STMTS: Mutex> = Mutex::new(Vec::new()); - } + static TRACED_STMTS: LazyLock>> = + LazyLock::new(|| Mutex::new(Vec::new())); fn tracer(s: &str) { let mut traced_stmts = TRACED_STMTS.lock().unwrap(); traced_stmts.push(s.to_owned()); @@ -159,9 +157,8 @@ mod test { #[test] fn test_profile() -> Result<()> { - lazy_static! { - static ref PROFILED: Mutex> = Mutex::new(Vec::new()); - } + static PROFILED: LazyLock>> = + LazyLock::new(|| Mutex::new(Vec::new())); fn profiler(s: &str, d: Duration) { let mut profiled = PROFILED.lock().unwrap(); profiled.push((s.to_owned(), d)); diff --git a/tests/config_log.rs b/tests/config_log.rs index 0c28bdf..e71c59c 100644 --- a/tests/config_log.rs +++ b/tests/config_log.rs @@ -4,13 +4,11 @@ #[cfg(feature = "trace")] fn main() { - use lazy_static::lazy_static; use std::os::raw::c_int; - use std::sync::Mutex; + use std::sync::{LazyLock, Mutex}; - lazy_static! { - static ref LOGS_RECEIVED: Mutex> = Mutex::new(Vec::new()); - } + static LOGS_RECEIVED: LazyLock>> = + LazyLock::new(|| Mutex::new(Vec::new())); fn log_handler(err: c_int, message: &str) { let mut logs_received = LOGS_RECEIVED.lock().unwrap();