diff options
| author | Scott McMurray <scottmcm@users.noreply.github.com> | 2019-02-17 19:42:36 -0800 |
|---|---|---|
| committer | Scott McMurray <scottmcm@users.noreply.github.com> | 2019-02-17 19:42:36 -0800 |
| commit | 3bea2ca49d24606920b3a81811379debc0668992 (patch) | |
| tree | 5e8cc79e957d9158bcdd1a26e848b7fbc7b24f97 /src/libstd/sys_common | |
| parent | 16ca0b9f6335db824e44629be1cafb6e3fcc4628 (diff) | |
| download | rust-3bea2ca49d24606920b3a81811379debc0668992.tar.gz rust-3bea2ca49d24606920b3a81811379debc0668992.zip | |
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<R: Read + ?Sized> 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.
Diffstat (limited to 'src/libstd/sys_common')
| -rw-r--r-- | src/libstd/sys_common/bytestring.rs | 2 | ||||
| -rw-r--r-- | src/libstd/sys_common/mutex.rs | 2 | ||||
| -rw-r--r-- | src/libstd/sys_common/remutex.rs | 8 |
3 files changed, 6 insertions, 6 deletions
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<T> !marker::Send for ReentrantMutexGuard<'_, T> {} impl<T> ReentrantMutex<T> { @@ -138,7 +138,7 @@ impl<'mutex, T> ReentrantMutexGuard<'mutex, T> { } } -impl<'mutex, T> Deref for ReentrantMutexGuard<'mutex, T> { +impl<T> 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<T> Drop for ReentrantMutexGuard<'_, T> { #[inline] fn drop(&mut self) { unsafe { @@ -212,7 +212,7 @@ mod tests { } pub struct Answer<'a>(pub ReentrantMutexGuard<'a, RefCell<u32>>); - impl<'a> Drop for Answer<'a> { + impl Drop for Answer<'_> { fn drop(&mut self) { *self.0.borrow_mut() = 42; } |
