From 3bea2ca49d24606920b3a81811379debc0668992 Mon Sep 17 00:00:00 2001 From: Scott McMurray Date: Sun, 17 Feb 2019 19:42:36 -0800 Subject: Use more impl header lifetime elision There are two big categories of changes in here - Removing lifetimes from common traits that can essentially never user a lifetime from an input (particularly `Drop` & `Debug`) - Forwarding impls that are only possible because the lifetime doesn't matter (like `impl Read for &mut R`) I omitted things that seemed like they could be more controversial, like the handful of iterators that have a `Item: 'static` despite the iterator having a lifetime or the `PartialEq` implementations where the flipped one cannot elide the lifetime. --- src/libstd/sys_common/bytestring.rs | 2 +- src/libstd/sys_common/mutex.rs | 2 +- src/libstd/sys_common/remutex.rs | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/libstd/sys_common') diff --git a/src/libstd/sys_common/bytestring.rs b/src/libstd/sys_common/bytestring.rs index df57fae4281..915c17374ca 100644 --- a/src/libstd/sys_common/bytestring.rs +++ b/src/libstd/sys_common/bytestring.rs @@ -31,7 +31,7 @@ mod tests { fn smoke() { struct Helper<'a>(&'a [u8]); - impl<'a> Debug for Helper<'a> { + impl Debug for Helper<'_> { fn fmt(&self, f: &mut Formatter) -> Result { debug_fmt_bytestring(self.0, f) } diff --git a/src/libstd/sys_common/mutex.rs b/src/libstd/sys_common/mutex.rs index 536f1c70db2..b47d8698c60 100644 --- a/src/libstd/sys_common/mutex.rs +++ b/src/libstd/sys_common/mutex.rs @@ -76,7 +76,7 @@ pub fn raw(mutex: &Mutex) -> &imp::Mutex { &mutex.0 } /// A simple RAII utility for the above Mutex without the poisoning semantics. pub struct MutexGuard<'a>(&'a imp::Mutex); -impl<'a> Drop for MutexGuard<'a> { +impl Drop for MutexGuard<'_> { #[inline] fn drop(&mut self) { unsafe { self.0.unlock(); } diff --git a/src/libstd/sys_common/remutex.rs b/src/libstd/sys_common/remutex.rs index 9ef24433f13..596e5d534c2 100644 --- a/src/libstd/sys_common/remutex.rs +++ b/src/libstd/sys_common/remutex.rs @@ -43,7 +43,7 @@ pub struct ReentrantMutexGuard<'a, T: 'a> { __poison: poison::Guard, } -impl<'a, T> !marker::Send for ReentrantMutexGuard<'a, T> {} +impl !marker::Send for ReentrantMutexGuard<'_, T> {} impl ReentrantMutex { @@ -138,7 +138,7 @@ impl<'mutex, T> ReentrantMutexGuard<'mutex, T> { } } -impl<'mutex, T> Deref for ReentrantMutexGuard<'mutex, T> { +impl Deref for ReentrantMutexGuard<'_, T> { type Target = T; fn deref(&self) -> &T { @@ -146,7 +146,7 @@ impl<'mutex, T> Deref for ReentrantMutexGuard<'mutex, T> { } } -impl<'a, T> Drop for ReentrantMutexGuard<'a, T> { +impl Drop for ReentrantMutexGuard<'_, T> { #[inline] fn drop(&mut self) { unsafe { @@ -212,7 +212,7 @@ mod tests { } pub struct Answer<'a>(pub ReentrantMutexGuard<'a, RefCell>); - impl<'a> Drop for Answer<'a> { + impl Drop for Answer<'_> { fn drop(&mut self) { *self.0.borrow_mut() = 42; } -- cgit 1.4.1-3-g733a5