diff --git a/tauri/Cargo.toml b/tauri/Cargo.toml index d7f1c8081..e3635763d 100644 --- a/tauri/Cargo.toml +++ b/tauri/Cargo.toml @@ -21,7 +21,6 @@ features = [ "api-all" ] serde_json = "1.0" serde = { version = "1.0", features = [ "derive" ] } base64 = "0.13.0" -lazy_static = "1.4.0" tokio = { version = "1.4", features = ["rt", "rt-multi-thread", "sync"] } futures = "0.3" async-trait = "0.1" diff --git a/tauri/src/app/event.rs b/tauri/src/app/event.rs index 88aa57bb5..939545ed9 100644 --- a/tauri/src/app/event.rs +++ b/tauri/src/app/event.rs @@ -5,10 +5,10 @@ use std::{ }; use crate::ApplicationDispatcherExt; -use lazy_static::lazy_static; use once_cell::sync::Lazy; use serde::Serialize; use serde_json::Value as JsonValue; +use uuid::Uuid; /// Event identifier. pub type EventId = u64; @@ -25,11 +25,9 @@ struct EventHandler { type Listeners = Arc>>>; -lazy_static! { - static ref EMIT_FUNCTION_NAME: String = uuid::Uuid::new_v4().to_string(); - static ref EVENT_LISTENERS_OBJECT_NAME: String = uuid::Uuid::new_v4().to_string(); - static ref EVENT_QUEUE_OBJECT_NAME: String = uuid::Uuid::new_v4().to_string(); -} +static EMIT_FUNCTION_NAME: Lazy = Lazy::new(|| Uuid::new_v4().to_string()); +static EVENT_LISTENERS_OBJECT_NAME: Lazy = Lazy::new(|| Uuid::new_v4().to_string()); +static EVENT_QUEUE_OBJECT_NAME: Lazy = Lazy::new(|| Uuid::new_v4().to_string()); /// Gets the listeners map. fn listeners() -> &'static Listeners { diff --git a/tauri/src/salt.rs b/tauri/src/salt.rs index c71d925df..60267448b 100644 --- a/tauri/src/salt.rs +++ b/tauri/src/salt.rs @@ -1,6 +1,6 @@ use std::sync::Mutex; -use lazy_static::lazy_static; +use once_cell::sync::Lazy; use uuid::Uuid; /// A salt definition. @@ -9,9 +9,7 @@ struct Salt { one_time: bool, } -lazy_static! { - static ref SALTS: Mutex> = Mutex::new(vec![]); -} +static SALTS: Lazy>> = Lazy::new(Mutex::default); /// Generates a one time Salt and returns its string representation. pub fn generate() -> String {