diff options
author | Iban Eguia <razican@protonmail.ch> | 2020-12-04 10:23:13 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-04 10:23:13 +0100 |
commit | 0dbba139848de6a8ee88350cc7fc48d0b05016c5 (patch) | |
tree | 73f3366b9c7a0c50d6dd146a2626368cf59b3178 /tokio/src | |
parent | a125ebd745f31098aa170cb1009ff0fe34508d37 (diff) |
deps: replace lazy_static with once_cell (#3187)
Diffstat (limited to 'tokio/src')
-rw-r--r-- | tokio/src/process/unix/mod.rs | 5 | ||||
-rw-r--r-- | tokio/src/signal/registry.rs | 10 |
2 files changed, 7 insertions, 8 deletions
diff --git a/tokio/src/process/unix/mod.rs b/tokio/src/process/unix/mod.rs index 966c2a28..3608b9f1 100644 --- a/tokio/src/process/unix/mod.rs +++ b/tokio/src/process/unix/mod.rs @@ -36,6 +36,7 @@ use crate::signal::unix::{signal, Signal, SignalKind}; use mio::event::Source; use mio::unix::SourceFd; +use once_cell::sync::Lazy; use std::fmt; use std::fs::File; use std::future::Future; @@ -62,9 +63,7 @@ impl Kill for StdChild { } } -lazy_static::lazy_static! { - static ref ORPHAN_QUEUE: OrphanQueueImpl<StdChild> = OrphanQueueImpl::new(); -} +static ORPHAN_QUEUE: Lazy<OrphanQueueImpl<StdChild>> = Lazy::new(OrphanQueueImpl::new); pub(crate) struct GlobalOrphanQueue; diff --git a/tokio/src/signal/registry.rs b/tokio/src/signal/registry.rs index 5d6f608c..55ee8c53 100644 --- a/tokio/src/signal/registry.rs +++ b/tokio/src/signal/registry.rs @@ -4,7 +4,7 @@ use crate::signal::os::{OsExtraData, OsStorage}; use crate::sync::mpsc::Sender; -use lazy_static::lazy_static; +use once_cell::sync::Lazy; use std::ops; use std::pin::Pin; use std::sync::atomic::{AtomicBool, Ordering}; @@ -165,12 +165,12 @@ where OsExtraData: 'static + Send + Sync + Init, OsStorage: 'static + Send + Sync + Init, { - lazy_static! { - static ref GLOBALS: Pin<Box<Globals>> = Box::pin(Globals { + static GLOBALS: Lazy<Pin<Box<Globals>>> = Lazy::new(|| { + Box::pin(Globals { extra: OsExtraData::init(), registry: Registry::new(OsStorage::init()), - }); - } + }) + }); GLOBALS.as_ref() } |