diff --git a/src/dir.rs b/src/dir.rs index eebb92d725..03f6a950c9 100644 --- a/src/dir.rs +++ b/src/dir.rs @@ -190,7 +190,7 @@ fn next(dir: &mut Dir) -> Option> { #[derive(Debug, Eq, Hash, PartialEq)] pub struct Iter<'d>(&'d mut Dir); -impl<'d> Iterator for Iter<'d> { +impl Iterator for Iter<'_> { type Item = Result; fn next(&mut self) -> Option { @@ -198,7 +198,7 @@ impl<'d> Iterator for Iter<'d> { } } -impl<'d> Drop for Iter<'d> { +impl Drop for Iter<'_> { fn drop(&mut self) { unsafe { libc::rewinddir((self.0).0.as_ptr()) } } diff --git a/src/mount/bsd_without_apple.rs b/src/mount/bsd_without_apple.rs index ae9eed7c0e..b387470c14 100644 --- a/src/mount/bsd_without_apple.rs +++ b/src/mount/bsd_without_apple.rs @@ -387,7 +387,7 @@ impl<'a> Nmount<'a> { } #[cfg(target_os = "freebsd")] -impl<'a> Drop for Nmount<'a> { +impl Drop for Nmount<'_> { fn drop(&mut self) { for (iov, is_owned) in self.iov.iter().zip(self.is_owned.iter()) { if *is_owned { diff --git a/src/poll.rs b/src/poll.rs index 7b34da77c5..5bc8616d84 100644 --- a/src/poll.rs +++ b/src/poll.rs @@ -96,7 +96,7 @@ impl<'fd> PollFd<'fd> { } } -impl<'fd> AsFd for PollFd<'fd> { +impl AsFd for PollFd<'_> { fn as_fd(&self) -> BorrowedFd<'_> { // Safety: // diff --git a/src/sys/aio.rs b/src/sys/aio.rs index c7ba40534c..3045b67de8 100644 --- a/src/sys/aio.rs +++ b/src/sys/aio.rs @@ -193,7 +193,7 @@ impl<'a> AioCb<'a> { } } -impl<'a> Debug for AioCb<'a> { +impl Debug for AioCb<'_> { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fmt.debug_struct("AioCb") .field("aiocb", &self.aiocb.0) @@ -202,7 +202,7 @@ impl<'a> Debug for AioCb<'a> { } } -impl<'a> Drop for AioCb<'a> { +impl Drop for AioCb<'_> { /// If the `AioCb` has no remaining state in the kernel, just drop it. /// Otherwise, dropping constitutes a resource leak, which is an error fn drop(&mut self) { @@ -499,7 +499,7 @@ impl<'a> Aio for AioFsync<'a> { // AioFsync does not need AsMut, since it can't be used with lio_listio -impl<'a> AsRef for AioFsync<'a> { +impl AsRef for AioFsync<'_> { fn as_ref(&self) -> &libc::aiocb { &self.aiocb.aiocb.0 } @@ -609,13 +609,13 @@ impl<'a> Aio for AioRead<'a> { aio_methods!(aio_read); } -impl<'a> AsMut for AioRead<'a> { +impl AsMut for AioRead<'_> { fn as_mut(&mut self) -> &mut libc::aiocb { &mut self.aiocb.aiocb.0 } } -impl<'a> AsRef for AioRead<'a> { +impl AsRef for AioRead<'_> { fn as_ref(&self) -> &libc::aiocb { &self.aiocb.aiocb.0 } @@ -732,14 +732,14 @@ impl<'a> Aio for AioReadv<'a> { } #[cfg(target_os = "freebsd")] -impl<'a> AsMut for AioReadv<'a> { +impl AsMut for AioReadv<'_> { fn as_mut(&mut self) -> &mut libc::aiocb { &mut self.aiocb.aiocb.0 } } #[cfg(target_os = "freebsd")] -impl<'a> AsRef for AioReadv<'a> { +impl AsRef for AioReadv<'_> { fn as_ref(&self) -> &libc::aiocb { &self.aiocb.aiocb.0 } @@ -845,13 +845,13 @@ impl<'a> Aio for AioWrite<'a> { aio_methods!(aio_write); } -impl<'a> AsMut for AioWrite<'a> { +impl AsMut for AioWrite<'_> { fn as_mut(&mut self) -> &mut libc::aiocb { &mut self.aiocb.aiocb.0 } } -impl<'a> AsRef for AioWrite<'a> { +impl AsRef for AioWrite<'_> { fn as_ref(&self) -> &libc::aiocb { &self.aiocb.aiocb.0 } @@ -965,14 +965,14 @@ impl<'a> Aio for AioWritev<'a> { } #[cfg(target_os = "freebsd")] -impl<'a> AsMut for AioWritev<'a> { +impl AsMut for AioWritev<'_> { fn as_mut(&mut self) -> &mut libc::aiocb { &mut self.aiocb.aiocb.0 } } #[cfg(target_os = "freebsd")] -impl<'a> AsRef for AioWritev<'a> { +impl AsRef for AioWritev<'_> { fn as_ref(&self) -> &libc::aiocb { &self.aiocb.aiocb.0 } diff --git a/src/sys/select.rs b/src/sys/select.rs index 64a8e258cf..29f6bd25a4 100644 --- a/src/sys/select.rs +++ b/src/sys/select.rs @@ -115,7 +115,7 @@ impl<'fd> FdSet<'fd> { } } -impl<'fd> Default for FdSet<'fd> { +impl Default for FdSet<'_> { fn default() -> Self { Self::new() } @@ -128,7 +128,7 @@ pub struct Fds<'a, 'fd> { range: Range, } -impl<'a, 'fd> Iterator for Fds<'a, 'fd> { +impl<'fd> Iterator for Fds<'_, 'fd> { type Item = BorrowedFd<'fd>; fn next(&mut self) -> Option { @@ -148,7 +148,7 @@ impl<'a, 'fd> Iterator for Fds<'a, 'fd> { } } -impl<'a, 'fd> DoubleEndedIterator for Fds<'a, 'fd> { +impl<'fd> DoubleEndedIterator for Fds<'_, 'fd> { #[inline] fn next_back(&mut self) -> Option> { while let Some(i) = self.range.next_back() { @@ -161,7 +161,7 @@ impl<'a, 'fd> DoubleEndedIterator for Fds<'a, 'fd> { } } -impl<'a, 'fd> FusedIterator for Fds<'a, 'fd> {} +impl FusedIterator for Fds<'_, '_> {} /// Monitors file descriptors for readiness /// diff --git a/src/sys/signal.rs b/src/sys/signal.rs index 62e58165ce..7304b973bb 100644 --- a/src/sys/signal.rs +++ b/src/sys/signal.rs @@ -1412,7 +1412,7 @@ mod sigevent { } } - impl<'a> From<&'a libc::sigevent> for SigEvent { + impl From<&'_ libc::sigevent> for SigEvent { #[cfg(target_os = "freebsd")] fn from(sigevent: &libc::sigevent) -> Self { // Safe because they're really the same structure. See diff --git a/src/sys/socket/mod.rs b/src/sys/socket/mod.rs index c9d90c32d4..53e85ba170 100644 --- a/src/sys/socket/mod.rs +++ b/src/sys/socket/mod.rs @@ -599,7 +599,7 @@ pub struct RecvMsg<'a, 's, S> { mhdr: msghdr, } -impl<'a, S> RecvMsg<'a, '_, S> { +impl RecvMsg<'_, '_, S> { /// Iterate over the valid control messages pointed to by this msghdr. If /// allocated space for CMSGs was too small it is not safe to iterate, /// instead return an `Error::ENOBUFS` error. @@ -623,7 +623,7 @@ pub struct CmsgIterator<'a> { mhdr: &'a msghdr } -impl<'a> Iterator for CmsgIterator<'a> { +impl Iterator for CmsgIterator<'_> { type Item = ControlMessageOwned; fn next(&mut self) -> Option { @@ -1260,7 +1260,7 @@ pub enum ControlMessage<'a> { #[derive(Clone, Debug, Eq, PartialEq)] pub struct UnknownCmsg(cmsghdr, Vec); -impl<'a> ControlMessage<'a> { +impl ControlMessage<'_> { /// The value of CMSG_SPACE on this message. /// Safe because CMSG_SPACE is always safe fn space(&self) -> usize { diff --git a/test/test.rs b/test/test.rs index 3160ca7143..56084622f7 100644 --- a/test/test.rs +++ b/test/test.rs @@ -85,7 +85,7 @@ struct DirRestore<'a> { _g: RwLockWriteGuard<'a, ()>, } -impl<'a> DirRestore<'a> { +impl DirRestore<'_> { fn new() -> Self { let guard = crate::CWD_LOCK.write(); DirRestore { @@ -95,7 +95,7 @@ impl<'a> DirRestore<'a> { } } -impl<'a> Drop for DirRestore<'a> { +impl Drop for DirRestore<'_> { fn drop(&mut self) { let r = chdir(&self.d); if std::thread::panicking() {