diff --git a/Cargo.lock b/Cargo.lock index 03c2199..479df72 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -209,9 +209,9 @@ dependencies = [ "ctrlc", "dateparser", "futures", - "lazy_static", "log", "moka", + "once_cell", "pretty_env_logger", "regex", "reqwest", diff --git a/Cargo.toml b/Cargo.toml index 4c0fb4a..e406946 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,7 +25,6 @@ regex = "1.8.3" chrono = "0.4.25" dateparser = "0.2.0" sentry = "0.31.3" -lazy_static = "1.4.0" moka = { version = "0.11.1", features = ["future"] } axum = "0.6.18" smallvec = { version = "1.10.0", features = ["serde"] } @@ -33,3 +32,4 @@ smartstring = { version = "1.0.1", features = ["serde"] } tokio-stream = "0.1.14" tower = "0.4.13" tower-http = { version = "0.4.3", features = ["trace"] } +once_cell = "1.18.0" diff --git a/src/config.rs b/src/config.rs index cc58498..72fbaf2 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,3 +1,5 @@ +use once_cell::sync::Lazy; + pub struct Config { pub telegram_bot_api: reqwest::Url, @@ -59,6 +61,6 @@ impl Config { } } -lazy_static! { - pub static ref CONFIG: Config = Config::load(); -} +pub static CONFIG: Lazy = Lazy::new(|| { + Config::load() +}); diff --git a/src/main.rs b/src/main.rs index e99a2d1..695ac46 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,3 @@ -#[macro_use] -extern crate lazy_static; - use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc;