Skip to content

Commit 6780d74

Browse files
taiki-ecramertj
authored andcommitted
Elide more lifetimes
1 parent d62c227 commit 6780d74

File tree

14 files changed

+46
-46
lines changed

14 files changed

+46
-46
lines changed

futures-channel/src/lock.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ impl<T> Lock<T> {
6161
}
6262
}
6363

64-
impl<'a, T> Deref for TryLock<'a, T> {
64+
impl<T> Deref for TryLock<'_, T> {
6565
type Target = T;
6666
fn deref(&self) -> &T {
6767
// The existence of `TryLock` represents that we own the lock, so we
@@ -70,7 +70,7 @@ impl<'a, T> Deref for TryLock<'a, T> {
7070
}
7171
}
7272

73-
impl<'a, T> DerefMut for TryLock<'a, T> {
73+
impl<T> DerefMut for TryLock<'_, T> {
7474
fn deref_mut(&mut self) -> &mut T {
7575
// The existence of `TryLock` represents that we own the lock, so we
7676
// can safely access the data here.
@@ -81,7 +81,7 @@ impl<'a, T> DerefMut for TryLock<'a, T> {
8181
}
8282
}
8383

84-
impl<'a, T> Drop for TryLock<'a, T> {
84+
impl<T> Drop for TryLock<'_, T> {
8585
fn drop(&mut self) {
8686
self.__ptr.locked.store(false, SeqCst);
8787
}

futures-core/src/future/future_obj.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub struct LocalFutureObj<'a, T> {
1919
_marker: PhantomData<&'a ()>,
2020
}
2121

22-
impl<'a, T> Unpin for LocalFutureObj<'a, T> {}
22+
impl<T> Unpin for LocalFutureObj<'_, T> {}
2323

2424
impl<'a, T> LocalFutureObj<'a, T> {
2525
/// Create a `LocalFutureObj` from a custom trait object representation.
@@ -43,7 +43,7 @@ impl<'a, T> LocalFutureObj<'a, T> {
4343
}
4444
}
4545

46-
impl<'a, T> fmt::Debug for LocalFutureObj<'a, T> {
46+
impl<T> fmt::Debug for LocalFutureObj<'_, T> {
4747
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
4848
f.debug_struct("LocalFutureObj")
4949
.finish()
@@ -57,7 +57,7 @@ impl<'a, T> From<FutureObj<'a, T>> for LocalFutureObj<'a, T> {
5757
}
5858
}
5959

60-
impl<'a, T> Future for LocalFutureObj<'a, T> {
60+
impl<T> Future for LocalFutureObj<'_, T> {
6161
type Output = T;
6262

6363
#[inline]
@@ -68,7 +68,7 @@ impl<'a, T> Future for LocalFutureObj<'a, T> {
6868
}
6969
}
7070

71-
impl<'a, T> Drop for LocalFutureObj<'a, T> {
71+
impl<T> Drop for LocalFutureObj<'_, T> {
7272
fn drop(&mut self) {
7373
unsafe {
7474
(self.drop_fn)(self.ptr)
@@ -89,8 +89,8 @@ impl<'a, T> Drop for LocalFutureObj<'a, T> {
8989
/// information #44874)
9090
pub struct FutureObj<'a, T>(LocalFutureObj<'a, T>);
9191

92-
impl<'a, T> Unpin for FutureObj<'a, T> {}
93-
unsafe impl<'a, T> Send for FutureObj<'a, T> {}
92+
impl<T> Unpin for FutureObj<'_, T> {}
93+
unsafe impl<T> Send for FutureObj<'_, T> {}
9494

9595
impl<'a, T> FutureObj<'a, T> {
9696
/// Create a `FutureObj` from a custom trait object representation.
@@ -100,19 +100,19 @@ impl<'a, T> FutureObj<'a, T> {
100100
}
101101
}
102102

103-
impl<'a, T> fmt::Debug for FutureObj<'a, T> {
103+
impl<T> fmt::Debug for FutureObj<'_, T> {
104104
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
105105
f.debug_struct("FutureObj")
106106
.finish()
107107
}
108108
}
109109

110-
impl<'a, T> Future for FutureObj<'a, T> {
110+
impl<T> Future for FutureObj<'_, T> {
111111
type Output = T;
112112

113113
#[inline]
114114
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<T> {
115-
let pinned_field: Pin<&mut LocalFutureObj<'a, T>> = unsafe {
115+
let pinned_field: Pin<&mut LocalFutureObj<'_, T>> = unsafe {
116116
Pin::map_unchecked_mut(self, |x| &mut x.0)
117117
};
118118
LocalFutureObj::poll(pinned_field, cx)

futures-core/src/stream/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ pub trait Stream {
5858
) -> Poll<Option<Self::Item>>;
5959
}
6060

61-
impl<'a, S: ?Sized + Stream + Unpin> Stream for &'a mut S {
61+
impl<S: ?Sized + Stream + Unpin> Stream for &mut S {
6262
type Item = S::Item;
6363

6464
fn poll_next(

futures-core/src/stream/stream_obj.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub struct LocalStreamObj<'a, T> {
1717
_marker: PhantomData<&'a ()>,
1818
}
1919

20-
impl<'a, T> Unpin for LocalStreamObj<'a, T> {}
20+
impl<T> Unpin for LocalStreamObj<'_, T> {}
2121

2222
impl<'a, T> LocalStreamObj<'a, T> {
2323
/// Create a `LocalStreamObj` from a custom trait object representation.
@@ -41,7 +41,7 @@ impl<'a, T> LocalStreamObj<'a, T> {
4141
}
4242
}
4343

44-
impl<'a, T> fmt::Debug for LocalStreamObj<'a, T> {
44+
impl<T> fmt::Debug for LocalStreamObj<'_, T> {
4545
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
4646
f.debug_struct("LocalStreamObj").finish()
4747
}
@@ -54,7 +54,7 @@ impl<'a, T> From<StreamObj<'a, T>> for LocalStreamObj<'a, T> {
5454
}
5555
}
5656

57-
impl<'a, T> Stream for LocalStreamObj<'a, T> {
57+
impl<T> Stream for LocalStreamObj<'_, T> {
5858
type Item = T;
5959

6060
#[inline]
@@ -66,7 +66,7 @@ impl<'a, T> Stream for LocalStreamObj<'a, T> {
6666
}
6767
}
6868

69-
impl<'a, T> Drop for LocalStreamObj<'a, T> {
69+
impl<T> Drop for LocalStreamObj<'_, T> {
7070
fn drop(&mut self) {
7171
unsafe { (self.drop_fn)(self.ptr) }
7272
}
@@ -85,8 +85,8 @@ impl<'a, T> Drop for LocalStreamObj<'a, T> {
8585
/// information #44874)
8686
pub struct StreamObj<'a, T>(LocalStreamObj<'a, T>);
8787

88-
impl<'a, T> Unpin for StreamObj<'a, T> {}
89-
unsafe impl<'a, T> Send for StreamObj<'a, T> {}
88+
impl<T> Unpin for StreamObj<'_, T> {}
89+
unsafe impl<T> Send for StreamObj<'_, T> {}
9090

9191
impl<'a, T> StreamObj<'a, T> {
9292
/// Create a `StreamObj` from a custom trait object representation.
@@ -96,13 +96,13 @@ impl<'a, T> StreamObj<'a, T> {
9696
}
9797
}
9898

99-
impl<'a, T> fmt::Debug for StreamObj<'a, T> {
99+
impl<T> fmt::Debug for StreamObj<'_, T> {
100100
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
101101
f.debug_struct("StreamObj").finish()
102102
}
103103
}
104104

105-
impl<'a, T> Stream for StreamObj<'a, T> {
105+
impl<T> Stream for StreamObj<'_, T> {
106106
type Item = T;
107107

108108
#[inline]

futures-io/src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,11 @@ mod if_std {
266266
deref_async_read!();
267267
}
268268

269-
impl<'a, T: ?Sized + AsyncRead + Unpin> AsyncRead for &'a mut T {
269+
impl<T: ?Sized + AsyncRead + Unpin> AsyncRead for &mut T {
270270
deref_async_read!();
271271
}
272272

273-
impl<'a, T: ?Sized + AsyncRead> AsyncRead for Pin<&'a mut T> {
273+
impl<T: ?Sized + AsyncRead> AsyncRead for Pin<&mut T> {
274274
unsafe fn initializer(&self) -> Initializer {
275275
(**self).initializer()
276276
}
@@ -304,7 +304,7 @@ mod if_std {
304304
}
305305
}
306306

307-
impl<'a> AsyncRead for &'a [u8] {
307+
impl AsyncRead for &[u8] {
308308
unsafe_delegate_async_read_to_stdio!();
309309
}
310310

@@ -344,11 +344,11 @@ mod if_std {
344344
deref_async_write!();
345345
}
346346

347-
impl<'a, T: ?Sized + AsyncWrite + Unpin> AsyncWrite for &'a mut T {
347+
impl<T: ?Sized + AsyncWrite + Unpin> AsyncWrite for &mut T {
348348
deref_async_write!();
349349
}
350350

351-
impl<'a, T: ?Sized + AsyncWrite> AsyncWrite for Pin<&'a mut T> {
351+
impl<T: ?Sized + AsyncWrite> AsyncWrite for Pin<&mut T> {
352352
fn poll_write(mut self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8])
353353
-> Poll<Result<usize>>
354354
{

futures-sink/src/channel_impls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl<T> Sink<T> for UnboundedSender<T> {
4545
}
4646
}
4747

48-
impl<'a, T> Sink<T> for &'a UnboundedSender<T> {
48+
impl<T> Sink<T> for &UnboundedSender<T> {
4949
type SinkError = SendError;
5050

5151
fn poll_ready(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::SinkError>> {

futures-sink/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ pub trait Sink<Item> {
110110
fn poll_close(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::SinkError>>;
111111
}
112112

113-
impl<'a, S: ?Sized + Sink<Item> + Unpin, Item> Sink<Item> for &'a mut S {
113+
impl<S: ?Sized + Sink<Item> + Unpin, Item> Sink<Item> for &mut S {
114114
type SinkError = S::SinkError;
115115

116116
fn poll_ready(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::SinkError>> {
@@ -130,7 +130,7 @@ impl<'a, S: ?Sized + Sink<Item> + Unpin, Item> Sink<Item> for &'a mut S {
130130
}
131131
}
132132

133-
impl<'a, S: ?Sized + Sink<Item>, Item> Sink<Item> for Pin<&'a mut S> {
133+
impl<S: ?Sized + Sink<Item>, Item> Sink<Item> for Pin<&mut S> {
134134
type SinkError = S::SinkError;
135135

136136
fn poll_ready(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::SinkError>> {

futures-util/src/compat/compat01as03.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,8 @@ struct NotifyWaker(task03::Waker);
316316
#[derive(Clone)]
317317
struct WakerToHandle<'a>(&'a task03::Waker);
318318

319-
impl<'a> From<WakerToHandle<'a>> for NotifyHandle01 {
320-
fn from(handle: WakerToHandle<'a>) -> NotifyHandle01 {
319+
impl From<WakerToHandle<'_>> for NotifyHandle01 {
320+
fn from(handle: WakerToHandle<'_>) -> NotifyHandle01 {
321321
let ptr = Box::new(NotifyWaker(handle.0.clone()));
322322

323323
unsafe { NotifyHandle01::new(Box::into_raw(ptr)) }

futures-util/src/future/shared.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ where
219219

220220
struct Reset<'a>(&'a AtomicUsize);
221221

222-
impl<'a> Drop for Reset<'a> {
222+
impl Drop for Reset<'_> {
223223
fn drop(&mut self) {
224224
use std::thread;
225225

futures-util/src/lock/bilock.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,20 +229,20 @@ pub struct BiLockGuard<'a, T> {
229229
bilock: &'a BiLock<T>,
230230
}
231231

232-
impl<'a, T> Deref for BiLockGuard<'a, T> {
232+
impl<T> Deref for BiLockGuard<'_, T> {
233233
type Target = T;
234234
fn deref(&self) -> &T {
235235
unsafe { &*self.bilock.arc.value.as_ref().unwrap().get() }
236236
}
237237
}
238238

239-
impl<'a, T: Unpin> DerefMut for BiLockGuard<'a, T> {
239+
impl<T: Unpin> DerefMut for BiLockGuard<'_, T> {
240240
fn deref_mut(&mut self) -> &mut T {
241241
unsafe { &mut *self.bilock.arc.value.as_ref().unwrap().get() }
242242
}
243243
}
244244

245-
impl<'a, T> BiLockGuard<'a, T> {
245+
impl<T> BiLockGuard<'_, T> {
246246
/// Get a mutable pinned reference to the locked value.
247247
pub fn as_pin_mut(&mut self) -> Pin<&mut T> {
248248
// Safety: we never allow moving a !Unpin value out of a bilock, nor
@@ -251,7 +251,7 @@ impl<'a, T> BiLockGuard<'a, T> {
251251
}
252252
}
253253

254-
impl<'a, T> Drop for BiLockGuard<'a, T> {
254+
impl<T> Drop for BiLockGuard<'_, T> {
255255
fn drop(&mut self) {
256256
self.bilock.unlock();
257257
}
@@ -266,7 +266,7 @@ pub struct BiLockAcquire<'a, T> {
266266
}
267267

268268
// Pinning is never projected to fields
269-
impl<'a, T> Unpin for BiLockAcquire<'a, T> {}
269+
impl<T> Unpin for BiLockAcquire<'_, T> {}
270270

271271
impl<'a, T> Future for BiLockAcquire<'a, T> {
272272
type Output = BiLockGuard<'a, T>;

0 commit comments

Comments
 (0)