From 4a52d188c83da106b882b03425a082821024609f Mon Sep 17 00:00:00 2001 From: MaxVerevkin Date: Sat, 6 Apr 2024 16:33:26 +0300 Subject: [PATCH] use tokio OnceCell instead of async-once-cell --- Cargo.lock | 7 ------- Cargo.toml | 1 - src/blocks/custom_dbus.rs | 6 +++--- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4f455f2cba..b343d3019f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -189,12 +189,6 @@ dependencies = [ "pin-project-lite", ] -[[package]] -name = "async-once-cell" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9338790e78aa95a416786ec8389546c4b6a1dfc3dc36071ed9518a9413a542eb" - [[package]] name = "async-pidfd" version = "0.1.4" @@ -1249,7 +1243,6 @@ dependencies = [ name = "i3status-rs" version = "0.33.0" dependencies = [ - "async-once-cell", "async-trait", "backon", "calibright", diff --git a/Cargo.toml b/Cargo.toml index 2b3c7ddc71..faaf9efd91 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,7 +29,6 @@ features = ["maildir", "notmuch"] rustdoc-args = ["--cfg", "docsrs"] [dependencies] -async-once-cell = "0.5" async-trait = "0.1" backon = "0.4.1" calibright = { version = "0.1.6", features = ["watch"] } diff --git a/src/blocks/custom_dbus.rs b/src/blocks/custom_dbus.rs index e5129a15cd..8b4d777f2b 100644 --- a/src/blocks/custom_dbus.rs +++ b/src/blocks/custom_dbus.rs @@ -57,8 +57,8 @@ use std::env; use zbus::fdo; // Share DBus connection between multiple block instances -static DBUS_CONNECTION: async_once_cell::OnceCell> = - async_once_cell::OnceCell::new(); +static DBUS_CONNECTION: tokio::sync::OnceCell> = + tokio::sync::OnceCell::const_new(); const DBUS_NAME: &str = "rs.i3status"; @@ -128,7 +128,7 @@ pub async fn run(config: &Config, api: &CommonApi) -> Result<()> { )?); let dbus_conn = DBUS_CONNECTION - .get_or_init(dbus_conn()) + .get_or_init(dbus_conn) .await .as_ref() .map_err(Clone::clone)?;