Skip to content

Commit

Permalink
async_fd: fixing a couple of PR nits
Browse files Browse the repository at this point in the history
  • Loading branch information
Bryan Donlan committed Oct 21, 2020
1 parent 62deeaf commit 5b09dbf
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions tokio/src/io/async_fd.rs
Expand Up @@ -78,9 +78,7 @@ impl<T: std::fmt::Debug> std::fmt::Debug for AsyncFd<T> {
}
}

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
Expand All @@ -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()
}
Expand Down Expand Up @@ -218,7 +216,7 @@ impl<T> AsyncFd<T> {

pub(crate) fn new_with_handle(inner: T, fd: RawFd, handle: Handle) -> io::Result<Self> {
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,
Expand Down

0 comments on commit 5b09dbf

Please sign in to comment.