Skip to content

Commit 4cbae63

Browse files
committed
Port rust-lang/rust@e70c2fbd: "liballoc: elide some lifetimes"
This commit ports rust-lang/rust commit e70c2fbd5cbe8bf176f1ed01ba9a53cec7e842a5 "liballoc: elide some lifetimes". Part of rust-lang/rust#58081: Transition liballoc to Rust 2018.
1 parent d5d672b commit 4cbae63

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

src/binary_heap.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -311,14 +311,14 @@ pub struct PeekMut<'a, T: 'a, C: 'a + Compare<T>> {
311311
}
312312

313313
// #[stable(feature = "collection_debug", since = "1.17.0")]
314-
impl<'a, T: fmt::Debug, C: Compare<T>> fmt::Debug for PeekMut<'a, T, C> {
315-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
314+
impl<T: fmt::Debug, C: Compare<T>> fmt::Debug for PeekMut<'_, T, C> {
315+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
316316
f.debug_tuple("PeekMut").field(&self.heap.data[0]).finish()
317317
}
318318
}
319319

320320
// #[stable(feature = "binary_heap_peek_mut", since = "1.12.0")]
321-
impl<'a, T, C: Compare<T>> Drop for PeekMut<'a, T, C> {
321+
impl<T, C: Compare<T>> Drop for PeekMut<'_, T, C> {
322322
fn drop(&mut self) {
323323
if self.sift {
324324
// SAFETY: PeekMut is only instantiated for non-empty heaps.
@@ -328,7 +328,7 @@ impl<'a, T, C: Compare<T>> Drop for PeekMut<'a, T, C> {
328328
}
329329

330330
// #[stable(feature = "binary_heap_peek_mut", since = "1.12.0")]
331-
impl<'a, T, C: Compare<T>> Deref for PeekMut<'a, T, C> {
331+
impl<T, C: Compare<T>> Deref for PeekMut<'_, T, C> {
332332
type Target = T;
333333
fn deref(&self) -> &T {
334334
debug_assert!(!self.heap.is_empty());
@@ -338,7 +338,7 @@ impl<'a, T, C: Compare<T>> Deref for PeekMut<'a, T, C> {
338338
}
339339

340340
// #[stable(feature = "binary_heap_peek_mut", since = "1.12.0")]
341-
impl<'a, T, C: Compare<T>> DerefMut for PeekMut<'a, T, C> {
341+
impl<T, C: Compare<T>> DerefMut for PeekMut<'_, T, C> {
342342
fn deref_mut(&mut self) -> &mut T {
343343
debug_assert!(!self.heap.is_empty());
344344
self.sift = true;
@@ -382,7 +382,7 @@ impl<T: Ord> Default for BinaryHeap<T> {
382382

383383
// #[stable(feature = "binaryheap_debug", since = "1.4.0")]
384384
impl<T: fmt::Debug, C: Compare<T>> fmt::Debug for BinaryHeap<T, C> {
385-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
385+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
386386
f.debug_list().entries(self.iter()).finish()
387387
}
388388
}
@@ -753,7 +753,7 @@ impl<T, C: Compare<T>> BinaryHeap<T, C> {
753753
/// assert_eq!(heap.peek(), Some(&2));
754754
/// ```
755755
// #[stable(feature = "binary_heap_peek_mut", since = "1.12.0")]
756-
pub fn peek_mut(&mut self) -> Option<PeekMut<T, C>> {
756+
pub fn peek_mut(&mut self) -> Option<PeekMut<'_, T, C>> {
757757
if self.is_empty() {
758758
None
759759
} else {
@@ -1169,7 +1169,7 @@ impl<T, C: Compare<T>> BinaryHeap<T, C> {
11691169
/// ```
11701170
#[inline]
11711171
// #[stable(feature = "drain", since = "1.6.0")]
1172-
pub fn drain(&mut self) -> Drain<T> {
1172+
pub fn drain(&mut self) -> Drain<'_, T> {
11731173
Drain {
11741174
iter: self.data.drain(..),
11751175
}
@@ -1344,7 +1344,7 @@ impl<'a, T> Hole<'a, T> {
13441344
}
13451345
}
13461346

1347-
impl<'a, T> Drop for Hole<'a, T> {
1347+
impl<T> Drop for Hole<'_, T> {
13481348
#[inline]
13491349
fn drop(&mut self) {
13501350
// fill the hole again
@@ -1368,16 +1368,16 @@ pub struct Iter<'a, T: 'a> {
13681368
}
13691369

13701370
// #[stable(feature = "collection_debug", since = "1.17.0")]
1371-
impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> {
1372-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1371+
impl<T: fmt::Debug> fmt::Debug for Iter<'_, T> {
1372+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
13731373
f.debug_tuple("Iter").field(&self.iter.as_slice()).finish()
13741374
}
13751375
}
13761376

13771377
// FIXME(#26925) Remove in favor of `#[derive(Clone)]`
13781378
// #[stable(feature = "rust1", since = "1.0.0")]
1379-
impl<'a, T> Clone for Iter<'a, T> {
1380-
fn clone(&self) -> Iter<'a, T> {
1379+
impl<T> Clone for Iter<'_, T> {
1380+
fn clone(&self) -> Self {
13811381
Iter {
13821382
iter: self.iter.clone(),
13831383
}
@@ -1432,7 +1432,7 @@ pub struct IntoIter<T> {
14321432

14331433
// #[stable(feature = "collection_debug", since = "1.17.0")]
14341434
impl<T: fmt::Debug> fmt::Debug for IntoIter<T> {
1435-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1435+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
14361436
f.debug_tuple("IntoIter")
14371437
.field(&self.iter.as_slice())
14381438
.finish()
@@ -1508,7 +1508,7 @@ pub struct Drain<'a, T: 'a> {
15081508
}
15091509

15101510
// #[stable(feature = "drain", since = "1.6.0")]
1511-
impl<'a, T: 'a> Iterator for Drain<'a, T> {
1511+
impl<T> Iterator for Drain<'_, T> {
15121512
type Item = T;
15131513

15141514
#[inline]
@@ -1523,7 +1523,7 @@ impl<'a, T: 'a> Iterator for Drain<'a, T> {
15231523
}
15241524

15251525
// #[stable(feature = "drain", since = "1.6.0")]
1526-
impl<'a, T: 'a> DoubleEndedIterator for Drain<'a, T> {
1526+
impl<T> DoubleEndedIterator for Drain<'_, T> {
15271527
#[inline]
15281528
fn next_back(&mut self) -> Option<T> {
15291529
self.iter.next_back()

0 commit comments

Comments
 (0)