| diff --git a/Cargo.toml b/Cargo.toml |
| index 61e58ce..5291a63 100644 |
| --- a/Cargo.toml |
| +++ b/Cargo.toml |
| @@ -205,10 +205,10 @@ version = "1.1.1" |
| optional = true |
| |
| [target."cfg(unix)".dev-dependencies.libc] |
| -version = "0.2.145" |
| +version = "0.2.149" |
| |
| [target."cfg(unix)".dev-dependencies.nix] |
| -version = "0.26" |
| +version = "0.28.0" |
| features = [ |
| "fs", |
| "socket", |
| diff --git a/tests/io_async_fd.rs b/tests/io_async_fd.rs |
| index 7abd592..aca2546 100644 |
| --- a/tests/io_async_fd.rs |
| +++ b/tests/io_async_fd.rs |
| @@ -13,7 +13,7 @@ use std::{ |
| task::{Context, Waker}, |
| }; |
| |
| -use nix::unistd::{close, read, write}; |
| +use nix::unistd::{read, write}; |
| |
| use futures::poll; |
| |
| @@ -57,18 +57,18 @@ impl TestWaker { |
| |
| #[derive(Debug)] |
| struct FileDescriptor { |
| - fd: RawFd, |
| + fd: std::os::fd::OwnedFd, |
| } |
| |
| impl AsRawFd for FileDescriptor { |
| fn as_raw_fd(&self) -> RawFd { |
| - self.fd |
| + self.fd.as_raw_fd() |
| } |
| } |
| |
| impl Read for &FileDescriptor { |
| fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { |
| - read(self.fd, buf).map_err(io::Error::from) |
| + read(self.fd.as_raw_fd(), buf).map_err(io::Error::from) |
| } |
| } |
| |
| @@ -80,7 +80,7 @@ impl Read for FileDescriptor { |
| |
| impl Write for &FileDescriptor { |
| fn write(&mut self, buf: &[u8]) -> io::Result<usize> { |
| - write(self.fd, buf).map_err(io::Error::from) |
| + write(&self.fd, buf).map_err(io::Error::from) |
| } |
| |
| fn flush(&mut self) -> io::Result<()> { |
| @@ -98,12 +98,6 @@ impl Write for FileDescriptor { |
| } |
| } |
| |
| -impl Drop for FileDescriptor { |
| - fn drop(&mut self) { |
| - let _ = close(self.fd); |
| - } |
| -} |
| - |
| fn set_nonblocking(fd: RawFd) { |
| use nix::fcntl::{OFlag, F_GETFL, F_SETFL}; |
| |
| @@ -134,8 +128,8 @@ fn socketpair() -> (FileDescriptor, FileDescriptor) { |
| .expect("socketpair"); |
| let fds = (FileDescriptor { fd: fd_a }, FileDescriptor { fd: fd_b }); |
| |
| - set_nonblocking(fds.0.fd); |
| - set_nonblocking(fds.1.fd); |
| + set_nonblocking(fds.0.fd.as_raw_fd()); |
| + set_nonblocking(fds.1.fd.as_raw_fd()); |
| |
| fds |
| } |