From 09c3424097f85a09d78c4865478216bf6c5b324a Mon Sep 17 00:00:00 2001 From: Hirrolot Date: Fri, 4 Feb 2022 20:14:57 +0600 Subject: [PATCH] Replace `lazy_static` with `once_cell` --- Cargo.toml | 2 +- examples/shared_state.rs | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 797ab9b0..10b0d85a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -96,7 +96,7 @@ aquamarine = "0.1.11" smart-default = "0.6.0" rand = "0.8.3" pretty_env_logger = "0.4.0" -lazy_static = "1.4.0" +once_cell = "1.9.0" anyhow = "1.0.52" serde = "1" serde_json = "1" diff --git a/examples/shared_state.rs b/examples/shared_state.rs index b397160f..c7e6f292 100644 --- a/examples/shared_state.rs +++ b/examples/shared_state.rs @@ -2,12 +2,10 @@ use std::sync::atomic::{AtomicU64, Ordering}; -use lazy_static::lazy_static; +use once_cell::sync::Lazy; use teloxide::prelude2::*; -lazy_static! { - static ref MESSAGES_TOTAL: AtomicU64 = AtomicU64::new(0); -} +static MESSAGES_TOTAL: Lazy = Lazy::new(AtomicU64::default); #[tokio::main] async fn main() {