From 5b09dbff86c807d0ab916ce03732998d554dfbee Mon Sep 17 00:00:00 2001 From: Bryan Donlan Date: Wed, 21 Oct 2020 19:30:29 +0000 Subject: [PATCH] async_fd: fixing a couple of PR nits --- tokio/src/io/async_fd.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tokio/src/io/async_fd.rs b/tokio/src/io/async_fd.rs index 1bfc5046e85..04ebe3f5a9d 100644 --- a/tokio/src/io/async_fd.rs +++ b/tokio/src/io/async_fd.rs @@ -78,9 +78,7 @@ impl std::fmt::Debug for AsyncFd { } } -const fn all_interest() -> mio::Interest { - mio::Interest::READABLE.add(mio::Interest::WRITABLE) -} +const ALL_INTEREST: mio::Interest = mio::Interest::READABLE.add(mio::Interest::WRITABLE); /// Represents an IO-ready event detected on a particular file descriptor, which /// has not yet been acknowledged. This is a `must_use` structure to help ensure @@ -93,7 +91,7 @@ pub struct ReadyGuard<'a, T> { impl<'a, T: std::fmt::Debug> std::fmt::Debug for ReadyGuard<'a, T> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.debug_struct("ClearReady") + f.debug_struct("ReadyGuard") .field("async_fd", self.async_fd) .finish() } @@ -218,7 +216,7 @@ impl AsyncFd { pub(crate) fn new_with_handle(inner: T, fd: RawFd, handle: Handle) -> io::Result { let shared = if let Some(inner) = handle.inner() { - inner.add_source(&mut SourceFd(&fd), all_interest())? + inner.add_source(&mut SourceFd(&fd), ALL_INTEREST)? } else { return Err(io::Error::new( io::ErrorKind::Other,