diff --git a/Cargo.toml b/Cargo.toml index 6c11e244f..b3e04f7e8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,6 @@ include = [ [target.'cfg(all(unix, not(target_os = "macos")))'.dependencies] dbus = { version = "0.9", optional = true } -lazy_static = { version = "1.5", optional = true } image = { version = "0.25", optional = true } zbus = { version = "5", optional = true, default-features = false } serde = { version = "1", optional = true } @@ -47,7 +46,8 @@ z-with-tokio = ["zbus", "serde", "tokio"] async = ["zbus/async-io"] tokio = ["zbus/tokio"] debug_namespace = [] -images = ["image", "lazy_static"] +images = ["image"] +lazy_static= [] # inert, here for backward compait, remove with next breaking change [dev-dependencies] color-backtrace = "0.7" # wait for MSVR 1.70 to update diff --git a/src/lib.rs b/src/lib.rs index f0af58ace..fdef19de1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -157,10 +157,6 @@ extern crate mac_notification_sys; #[cfg(target_os = "windows")] extern crate winrt_notification; -#[macro_use] -#[cfg(all(feature = "images", unix, not(target_os = "macos")))] -extern crate lazy_static; - pub mod error; mod hints; mod miniver; @@ -213,13 +209,13 @@ pub use crate::urgency::Urgency; pub use crate::{notification::Notification, timeout::Timeout}; #[cfg(all(feature = "images", unix, not(target_os = "macos")))] -lazy_static! { - /// Read once at runtime. Needed for Images - pub static ref SPEC_VERSION: miniver::Version = - get_server_information() +/// Read once at runtime. Needed for Images +pub static SPEC_VERSION: std::sync::LazyLock = std::sync::LazyLock::new(|| { + get_server_information() .and_then(|info| info.spec_version.parse::()) - .unwrap_or_else(|_| miniver::Version::new(1,1)); -} + .unwrap_or_else(|_| miniver::Version::new(1, 1)) +}); + /// Return value of `get_server_information()`. #[derive(Debug)] pub struct ServerInformation {