mirror of
https://github.com/isar/rusqlite.git
synced 2025-04-01 03:22:58 +08:00
Remove lazy_static dependency
Replaced by LazyLock
This commit is contained in:
parent
499cc7bb98
commit
d3e3c56474
@ -129,7 +129,6 @@ rusqlite-macros = { path = "rusqlite-macros", version = "0.3.0", optional = true
|
|||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
doc-comment = "0.3"
|
doc-comment = "0.3"
|
||||||
tempfile = "3.1.0"
|
tempfile = "3.1.0"
|
||||||
lazy_static = "1.4"
|
|
||||||
regex = "1.5.5"
|
regex = "1.5.5"
|
||||||
uuid = { version = "1.0", features = ["v4"] }
|
uuid = { version = "1.0", features = ["v4"] }
|
||||||
unicase = "2.6.0"
|
unicase = "2.6.0"
|
||||||
|
13
src/trace.rs
13
src/trace.rs
@ -122,17 +122,15 @@ impl Connection {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use lazy_static::lazy_static;
|
use std::sync::{LazyLock, Mutex};
|
||||||
use std::sync::Mutex;
|
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use crate::{Connection, Result};
|
use crate::{Connection, Result};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_trace() -> Result<()> {
|
fn test_trace() -> Result<()> {
|
||||||
lazy_static! {
|
static TRACED_STMTS: LazyLock<Mutex<Vec<String>>> =
|
||||||
static ref TRACED_STMTS: Mutex<Vec<String>> = Mutex::new(Vec::new());
|
LazyLock::new(|| Mutex::new(Vec::new()));
|
||||||
}
|
|
||||||
fn tracer(s: &str) {
|
fn tracer(s: &str) {
|
||||||
let mut traced_stmts = TRACED_STMTS.lock().unwrap();
|
let mut traced_stmts = TRACED_STMTS.lock().unwrap();
|
||||||
traced_stmts.push(s.to_owned());
|
traced_stmts.push(s.to_owned());
|
||||||
@ -159,9 +157,8 @@ mod test {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_profile() -> Result<()> {
|
fn test_profile() -> Result<()> {
|
||||||
lazy_static! {
|
static PROFILED: LazyLock<Mutex<Vec<(String, Duration)>>> =
|
||||||
static ref PROFILED: Mutex<Vec<(String, Duration)>> = Mutex::new(Vec::new());
|
LazyLock::new(|| Mutex::new(Vec::new()));
|
||||||
}
|
|
||||||
fn profiler(s: &str, d: Duration) {
|
fn profiler(s: &str, d: Duration) {
|
||||||
let mut profiled = PROFILED.lock().unwrap();
|
let mut profiled = PROFILED.lock().unwrap();
|
||||||
profiled.push((s.to_owned(), d));
|
profiled.push((s.to_owned(), d));
|
||||||
|
@ -4,13 +4,11 @@
|
|||||||
|
|
||||||
#[cfg(feature = "trace")]
|
#[cfg(feature = "trace")]
|
||||||
fn main() {
|
fn main() {
|
||||||
use lazy_static::lazy_static;
|
|
||||||
use std::os::raw::c_int;
|
use std::os::raw::c_int;
|
||||||
use std::sync::Mutex;
|
use std::sync::{LazyLock, Mutex};
|
||||||
|
|
||||||
lazy_static! {
|
static LOGS_RECEIVED: LazyLock<Mutex<Vec<(c_int, String)>>> =
|
||||||
static ref LOGS_RECEIVED: Mutex<Vec<(c_int, String)>> = Mutex::new(Vec::new());
|
LazyLock::new(|| Mutex::new(Vec::new()));
|
||||||
}
|
|
||||||
|
|
||||||
fn log_handler(err: c_int, message: &str) {
|
fn log_handler(err: c_int, message: &str) {
|
||||||
let mut logs_received = LOGS_RECEIVED.lock().unwrap();
|
let mut logs_received = LOGS_RECEIVED.lock().unwrap();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user