about summary refs log tree commit diff
path: root/src/libstd/sys_common/remutex.rs
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2019-02-20 01:13:39 +0800
committerkennytm <kennytm@gmail.com>2019-02-20 11:59:10 +0800
commite3a8f7db479ce6562bfc312f412b65dc4f3c77d5 (patch)
tree9312a71b7625ef7e88c687e49cdece9451519b2b /src/libstd/sys_common/remutex.rs
parentef0aaddf691030874e147ca5ee79332fec0c9566 (diff)
parent3bea2ca49d24606920b3a81811379debc0668992 (diff)
downloadrust-e3a8f7db479ce6562bfc312f412b65dc4f3c77d5.tar.gz
rust-e3a8f7db479ce6562bfc312f412b65dc4f3c77d5.zip
Rollup merge of #58553 - scottmcm:more-ihle, r=Centril
Use more impl header lifetime elision

Inspired by seeing explicit lifetimes on these two:

- https://doc.rust-lang.org/nightly/std/slice/struct.Iter.html#impl-FusedIterator
- https://doc.rust-lang.org/nightly/std/primitive.u32.html#impl-Not

And a follow-up to https://github.com/rust-lang/rust/pull/54687, that started using IHLE in libcore.

Most of the changes in here fall into two big categories:

- Removing lifetimes from common traits that can essentially never user a lifetime from an input (particularly `Drop`, `Debug`, and `Clone`)

- 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](https://internals.rust-lang.org/t/impl-type-parameter-aliases/9403/2?u=scottmcm).

I also removed two lifetimes that turned out to be completely unused; see https://github.com/rust-lang/rust/issues/41960#issuecomment-464557423
Diffstat (limited to 'src/libstd/sys_common/remutex.rs')
-rw-r--r--src/libstd/sys_common/remutex.rs8
1 files changed, 4 insertions, 4 deletions
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;
         }