From b9ae7e6659f31508fbe81e29508984d0c6f2d0b4 Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Sun, 18 Dec 2022 09:42:59 +0100 Subject: [PATCH] signal: remove redundant Pin around globals (#5303) --- tokio/src/signal/registry.rs | 5 ++--- tokio/src/signal/unix.rs | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/tokio/src/signal/registry.rs b/tokio/src/signal/registry.rs index e1b3d108767..48e98c832fa 100644 --- a/tokio/src/signal/registry.rs +++ b/tokio/src/signal/registry.rs @@ -5,7 +5,6 @@ use crate::sync::watch; use crate::util::once_cell::OnceCell; use std::ops; -use std::pin::Pin; use std::sync::atomic::{AtomicBool, Ordering}; pub(crate) type EventId = usize; @@ -162,14 +161,14 @@ where } } -pub(crate) fn globals() -> Pin<&'static Globals> +pub(crate) fn globals() -> &'static Globals where OsExtraData: 'static + Send + Sync + Init, OsStorage: 'static + Send + Sync + Init, { static GLOBALS: OnceCell = OnceCell::new(); - Pin::new(GLOBALS.get(globals_init)) + GLOBALS.get(globals_init) } #[cfg(all(test, not(loom)))] diff --git a/tokio/src/signal/unix.rs b/tokio/src/signal/unix.rs index 0e1329ed54f..e5345fdfccc 100644 --- a/tokio/src/signal/unix.rs +++ b/tokio/src/signal/unix.rs @@ -14,7 +14,6 @@ use crate::sync::watch; use mio::net::UnixStream; use std::io::{self, Error, ErrorKind, Write}; -use std::pin::Pin; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Once; use std::task::{Context, Poll}; @@ -240,7 +239,7 @@ impl Default for SignalInfo { /// 2. Wake up the driver by writing a byte to a pipe /// /// Those two operations should both be async-signal safe. -fn action(globals: Pin<&'static Globals>, signal: libc::c_int) { +fn action(globals: &'static Globals, signal: libc::c_int) { globals.record_event(signal as EventId); // Send a wakeup, ignore any errors (anything reasonably possible is