diff --git a/CHANGELOG.md b/CHANGELOG.md index 06be48d30..eb135ef7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog -## v0.2.0-alhpa.5 +## v0.2.0-alpha.6 + +- Remove lazy_static in favor of once_cell + +## v0.2.0-alpha.5 - Fix possible stack overflows with conditions - Foreign key constraint errors diff --git a/Cargo.toml b/Cargo.toml index 47d0ce4d3..bbbe111f3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "quaint" -version = "0.2.0-alpha.5" +version = "0.2.0-alpha.6" authors = [ "Julius de Bruijn ", "Katharina Fey ", @@ -49,7 +49,7 @@ serde-support = ["serde", "chrono/serde"] url = "2.1" metrics = "0.12" percent-encoding = "2" -lazy_static = "1.4" +once_cell = "1.3" num_cpus = "1.12" rust_decimal = "=1.1.0" futures = "0.3" diff --git a/src/connector/mysql.rs b/src/connector/mysql.rs index f9bd75ef1..c596d91b4 100644 --- a/src/connector/mysql.rs +++ b/src/connector/mysql.rs @@ -324,13 +324,11 @@ impl Queryable for Mysql { mod tests { use super::MysqlUrl; use crate::{connector::Queryable, error::*, single::Quaint}; - use lazy_static::lazy_static; + use once_cell::sync::Lazy; use std::env; use url::Url; - lazy_static! { - static ref CONN_STR: String = env::var("TEST_MYSQL").expect("TEST_MYSQL env var"); - } + static CONN_STR: Lazy = Lazy::new(|| env::var("TEST_MYSQL").expect("TEST_MYSQL env var")); #[test] fn should_parse_socket_url() { diff --git a/src/connector/postgres.rs b/src/connector/postgres.rs index a30513899..32ab7f97b 100644 --- a/src/connector/postgres.rs +++ b/src/connector/postgres.rs @@ -456,13 +456,11 @@ impl Queryable for PostgreSql { mod tests { use super::*; use crate::{connector::Queryable, error::*, single::Quaint}; - use lazy_static::lazy_static; + use once_cell::sync::Lazy; use std::env; use url::Url; - lazy_static! { - static ref CONN_STR: String = env::var("TEST_PSQL").expect("TEST_PSQL env var"); - } + static CONN_STR: Lazy = Lazy::new(|| env::var("TEST_PSQL").expect("TEST_PSQL env var")); #[test] fn should_parse_socket_url() { diff --git a/src/lib.rs b/src/lib.rs index 1a5698919..732e44a2b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -126,14 +126,11 @@ pub mod prelude; #[cfg(any(feature = "sqlite", feature = "mysql", feature = "postgresql"))] pub mod single; pub mod visitor; - #[cfg(feature = "serde-support")] pub mod serde; -pub type Result = std::result::Result; +use once_cell::sync::Lazy; -use lazy_static::lazy_static; +pub(crate) static LOG_QUERIES: Lazy = Lazy::new(|| std::env::var("LOG_QUERIES").map(|_| true).unwrap_or(false)); -lazy_static! { - static ref LOG_QUERIES: bool = std::env::var("LOG_QUERIES").map(|_| true).unwrap_or(false); -} +pub type Result = std::result::Result;