From 6c0f6890e4d277ee2a33325d07954c3c635c7285 Mon Sep 17 00:00:00 2001 From: Maximiliano Sandoval Date: Wed, 14 Aug 2024 09:19:52 +0200 Subject: [PATCH] async: remove lazy_static dependency Signed-off-by: Maximiliano Sandoval --- proxmox-async/Cargo.toml | 2 +- proxmox-async/src/runtime.rs | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/proxmox-async/Cargo.toml b/proxmox-async/Cargo.toml index 669ae08b..8508ef5d 100644 --- a/proxmox-async/Cargo.toml +++ b/proxmox-async/Cargo.toml @@ -6,13 +6,13 @@ edition.workspace = true license.workspace = true repository.workspace = true description = "Proxmox async/tokio helpers" +rust-version.workspace = true exclude.workspace = true [dependencies] anyhow.workspace = true futures.workspace = true -lazy_static.workspace = true pin-utils.workspace = true tokio = { workspace = true, features = [ "net", "rt", "rt-multi-thread", "sync"] } diff --git a/proxmox-async/src/runtime.rs b/proxmox-async/src/runtime.rs index efc1cd88..0721fd9e 100644 --- a/proxmox-async/src/runtime.rs +++ b/proxmox-async/src/runtime.rs @@ -33,19 +33,16 @@ //! [openssl-bug]: https://github.com/openssl/openssl/issues/6214 use std::future::Future; -use std::sync::{Arc, Mutex, Weak}; +use std::sync::{Arc, LazyLock, Mutex, Weak}; use std::task::{Context, Poll, Waker}; use std::thread::{self, Thread}; -use lazy_static::lazy_static; use pin_utils::pin_mut; use tokio::runtime::{self, Runtime, RuntimeFlavor}; -lazy_static! { - // avoid openssl bug: https://github.com/openssl/openssl/issues/6214 - // by dropping the runtime as early as possible - static ref RUNTIME: Mutex> = Mutex::new(Weak::new()); -} +// avoid openssl bug: https://github.com/openssl/openssl/issues/6214 +// by dropping the runtime as early as possible +static RUNTIME: LazyLock>> = LazyLock::new(|| Mutex::new(Weak::new())); #[link(name = "crypto")] extern "C" {