Skip to content

Commit e70c2fb

Browse files
committedFeb 2, 2019
liballoc: elide some lifetimes.
1 parent 748970d commit e70c2fb

File tree

12 files changed

+119
-126
lines changed

12 files changed

+119
-126
lines changed
 

Diff for: ‎src/liballoc/borrow.rs

+7-13
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,7 @@ pub enum Cow<'a, B: ?Sized + 'a>
183183
}
184184

185185
#[stable(feature = "rust1", since = "1.0.0")]
186-
impl<'a, B: ?Sized> Clone for Cow<'a, B>
187-
where B: ToOwned
188-
{
186+
impl<'a, B: ?Sized + ToOwned> Clone for Cow<'a, B> {
189187
fn clone(&self) -> Cow<'a, B> {
190188
match *self {
191189
Borrowed(b) => Borrowed(b),
@@ -208,9 +206,7 @@ impl<'a, B: ?Sized> Clone for Cow<'a, B>
208206
}
209207
}
210208

211-
impl<'a, B: ?Sized> Cow<'a, B>
212-
where B: ToOwned
213-
{
209+
impl<B: ?Sized + ToOwned> Cow<'_, B> {
214210
/// Acquires a mutable reference to the owned form of the data.
215211
///
216212
/// Clones the data if it is not already owned.
@@ -286,9 +282,7 @@ impl<'a, B: ?Sized> Cow<'a, B>
286282
}
287283

288284
#[stable(feature = "rust1", since = "1.0.0")]
289-
impl<'a, B: ?Sized> Deref for Cow<'a, B>
290-
where B: ToOwned
291-
{
285+
impl<B: ?Sized + ToOwned> Deref for Cow<'_, B> {
292286
type Target = B;
293287

294288
fn deref(&self) -> &B {
@@ -300,7 +294,7 @@ impl<'a, B: ?Sized> Deref for Cow<'a, B>
300294
}
301295

302296
#[stable(feature = "rust1", since = "1.0.0")]
303-
impl<'a, B: ?Sized> Eq for Cow<'a, B> where B: Eq + ToOwned {}
297+
impl<B: ?Sized> Eq for Cow<'_, B> where B: Eq + ToOwned {}
304298

305299
#[stable(feature = "rust1", since = "1.0.0")]
306300
impl<'a, B: ?Sized> Ord for Cow<'a, B>
@@ -334,7 +328,7 @@ impl<'a, B: ?Sized> PartialOrd for Cow<'a, B>
334328
}
335329

336330
#[stable(feature = "rust1", since = "1.0.0")]
337-
impl<'a, B: ?Sized> fmt::Debug for Cow<'a, B>
331+
impl<B: ?Sized> fmt::Debug for Cow<'_, B>
338332
where B: fmt::Debug + ToOwned,
339333
<B as ToOwned>::Owned: fmt::Debug
340334
{
@@ -347,7 +341,7 @@ impl<'a, B: ?Sized> fmt::Debug for Cow<'a, B>
347341
}
348342

349343
#[stable(feature = "rust1", since = "1.0.0")]
350-
impl<'a, B: ?Sized> fmt::Display for Cow<'a, B>
344+
impl<B: ?Sized> fmt::Display for Cow<'_, B>
351345
where B: fmt::Display + ToOwned,
352346
<B as ToOwned>::Owned: fmt::Display
353347
{
@@ -381,7 +375,7 @@ impl<'a, B: ?Sized> Hash for Cow<'a, B>
381375
}
382376

383377
#[stable(feature = "rust1", since = "1.0.0")]
384-
impl<'a, T: ?Sized + ToOwned> AsRef<T> for Cow<'a, T> {
378+
impl<T: ?Sized + ToOwned> AsRef<T> for Cow<'_, T> {
385379
fn as_ref(&self) -> &T {
386380
self
387381
}

Diff for: ‎src/liballoc/boxed.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ impl<A, F> FnBox<A> for F
739739

740740
#[unstable(feature = "fnbox",
741741
reason = "will be deprecated if and when `Box<FnOnce>` becomes usable", issue = "28796")]
742-
impl<'a, A, R> FnOnce<A> for Box<dyn FnBox<A, Output = R> + 'a> {
742+
impl<A, R> FnOnce<A> for Box<dyn FnBox<A, Output = R> + '_> {
743743
type Output = R;
744744

745745
extern "rust-call" fn call_once(self, args: A) -> R {
@@ -749,7 +749,7 @@ impl<'a, A, R> FnOnce<A> for Box<dyn FnBox<A, Output = R> + 'a> {
749749

750750
#[unstable(feature = "fnbox",
751751
reason = "will be deprecated if and when `Box<FnOnce>` becomes usable", issue = "28796")]
752-
impl<'a, A, R> FnOnce<A> for Box<dyn FnBox<A, Output = R> + Send + 'a> {
752+
impl<A, R> FnOnce<A> for Box<dyn FnBox<A, Output = R> + Send + '_> {
753753
type Output = R;
754754

755755
extern "rust-call" fn call_once(self, args: A) -> R {

Diff for: ‎src/liballoc/collections/binary_heap.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ pub struct PeekMut<'a, T: 'a + Ord> {
231231
}
232232

233233
#[stable(feature = "collection_debug", since = "1.17.0")]
234-
impl<'a, T: Ord + fmt::Debug> fmt::Debug for PeekMut<'a, T> {
234+
impl<T: Ord + fmt::Debug> fmt::Debug for PeekMut<'_, T> {
235235
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
236236
f.debug_tuple("PeekMut")
237237
.field(&self.heap.data[0])
@@ -240,7 +240,7 @@ impl<'a, T: Ord + fmt::Debug> fmt::Debug for PeekMut<'a, T> {
240240
}
241241

242242
#[stable(feature = "binary_heap_peek_mut", since = "1.12.0")]
243-
impl<'a, T: Ord> Drop for PeekMut<'a, T> {
243+
impl<T: Ord> Drop for PeekMut<'_, T> {
244244
fn drop(&mut self) {
245245
if self.sift {
246246
self.heap.sift_down(0);
@@ -249,15 +249,15 @@ impl<'a, T: Ord> Drop for PeekMut<'a, T> {
249249
}
250250

251251
#[stable(feature = "binary_heap_peek_mut", since = "1.12.0")]
252-
impl<'a, T: Ord> Deref for PeekMut<'a, T> {
252+
impl<T: Ord> Deref for PeekMut<'_, T> {
253253
type Target = T;
254254
fn deref(&self) -> &T {
255255
&self.heap.data[0]
256256
}
257257
}
258258

259259
#[stable(feature = "binary_heap_peek_mut", since = "1.12.0")]
260-
impl<'a, T: Ord> DerefMut for PeekMut<'a, T> {
260+
impl<T: Ord> DerefMut for PeekMut<'_, T> {
261261
fn deref_mut(&mut self) -> &mut T {
262262
&mut self.heap.data[0]
263263
}
@@ -912,7 +912,7 @@ impl<'a, T> Hole<'a, T> {
912912
}
913913
}
914914

915-
impl<'a, T> Drop for Hole<'a, T> {
915+
impl<T> Drop for Hole<'_, T> {
916916
#[inline]
917917
fn drop(&mut self) {
918918
// fill the hole again
@@ -936,7 +936,7 @@ pub struct Iter<'a, T: 'a> {
936936
}
937937

938938
#[stable(feature = "collection_debug", since = "1.17.0")]
939-
impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> {
939+
impl<T: fmt::Debug> fmt::Debug for Iter<'_, T> {
940940
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
941941
f.debug_tuple("Iter")
942942
.field(&self.iter.as_slice())
@@ -976,14 +976,14 @@ impl<'a, T> DoubleEndedIterator for Iter<'a, T> {
976976
}
977977

978978
#[stable(feature = "rust1", since = "1.0.0")]
979-
impl<'a, T> ExactSizeIterator for Iter<'a, T> {
979+
impl<T> ExactSizeIterator for Iter<'_, T> {
980980
fn is_empty(&self) -> bool {
981981
self.iter.is_empty()
982982
}
983983
}
984984

985985
#[stable(feature = "fused", since = "1.26.0")]
986-
impl<'a, T> FusedIterator for Iter<'a, T> {}
986+
impl<T> FusedIterator for Iter<'_, T> {}
987987

988988
/// An owning iterator over the elements of a `BinaryHeap`.
989989
///
@@ -1054,7 +1054,7 @@ pub struct Drain<'a, T: 'a> {
10541054
}
10551055

10561056
#[stable(feature = "drain", since = "1.6.0")]
1057-
impl<'a, T: 'a> Iterator for Drain<'a, T> {
1057+
impl<T> Iterator for Drain<'_, T> {
10581058
type Item = T;
10591059

10601060
#[inline]
@@ -1069,22 +1069,22 @@ impl<'a, T: 'a> Iterator for Drain<'a, T> {
10691069
}
10701070

10711071
#[stable(feature = "drain", since = "1.6.0")]
1072-
impl<'a, T: 'a> DoubleEndedIterator for Drain<'a, T> {
1072+
impl<T> DoubleEndedIterator for Drain<'_, T> {
10731073
#[inline]
10741074
fn next_back(&mut self) -> Option<T> {
10751075
self.iter.next_back()
10761076
}
10771077
}
10781078

10791079
#[stable(feature = "drain", since = "1.6.0")]
1080-
impl<'a, T: 'a> ExactSizeIterator for Drain<'a, T> {
1080+
impl<T> ExactSizeIterator for Drain<'_, T> {
10811081
fn is_empty(&self) -> bool {
10821082
self.iter.is_empty()
10831083
}
10841084
}
10851085

10861086
#[stable(feature = "fused", since = "1.26.0")]
1087-
impl<'a, T: 'a> FusedIterator for Drain<'a, T> {}
1087+
impl<T> FusedIterator for Drain<'_, T> {}
10881088

10891089
#[stable(feature = "binary_heap_extras_15", since = "1.5.0")]
10901090
impl<T: Ord> From<Vec<T>> for BinaryHeap<T> {

Diff for: ‎src/liballoc/collections/btree/map.rs

+21-22
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ pub struct Iter<'a, K: 'a, V: 'a> {
279279
}
280280

281281
#[stable(feature = "collection_debug", since = "1.17.0")]
282-
impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Iter<'a, K, V> {
282+
impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for Iter<'_, K, V> {
283283
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
284284
f.debug_list().entries(self.clone()).finish()
285285
}
@@ -337,7 +337,7 @@ pub struct Keys<'a, K: 'a, V: 'a> {
337337
}
338338

339339
#[stable(feature = "collection_debug", since = "1.17.0")]
340-
impl<'a, K: 'a + fmt::Debug, V: 'a> fmt::Debug for Keys<'a, K, V> {
340+
impl<K: fmt::Debug, V> fmt::Debug for Keys<'_, K, V> {
341341
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
342342
f.debug_list().entries(self.clone()).finish()
343343
}
@@ -356,7 +356,7 @@ pub struct Values<'a, K: 'a, V: 'a> {
356356
}
357357

358358
#[stable(feature = "collection_debug", since = "1.17.0")]
359-
impl<'a, K: 'a, V: 'a + fmt::Debug> fmt::Debug for Values<'a, K, V> {
359+
impl<K, V: fmt::Debug> fmt::Debug for Values<'_, K, V> {
360360
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
361361
f.debug_list().entries(self.clone()).finish()
362362
}
@@ -389,7 +389,7 @@ pub struct Range<'a, K: 'a, V: 'a> {
389389
}
390390

391391
#[stable(feature = "collection_debug", since = "1.17.0")]
392-
impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Range<'a, K, V> {
392+
impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for Range<'_, K, V> {
393393
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
394394
f.debug_list().entries(self.clone()).finish()
395395
}
@@ -412,7 +412,7 @@ pub struct RangeMut<'a, K: 'a, V: 'a> {
412412
}
413413

414414
#[stable(feature = "collection_debug", since = "1.17.0")]
415-
impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for RangeMut<'a, K, V> {
415+
impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for RangeMut<'_, K, V> {
416416
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
417417
let range = Range {
418418
front: self.front.reborrow(),
@@ -442,7 +442,7 @@ pub enum Entry<'a, K: 'a, V: 'a> {
442442
}
443443

444444
#[stable(feature= "debug_btree_map", since = "1.12.0")]
445-
impl<'a, K: 'a + Debug + Ord, V: 'a + Debug> Debug for Entry<'a, K, V> {
445+
impl<K: Debug + Ord, V: Debug> Debug for Entry<'_, K, V> {
446446
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
447447
match *self {
448448
Vacant(ref v) => f.debug_tuple("Entry")
@@ -470,7 +470,7 @@ pub struct VacantEntry<'a, K: 'a, V: 'a> {
470470
}
471471

472472
#[stable(feature= "debug_btree_map", since = "1.12.0")]
473-
impl<'a, K: 'a + Debug + Ord, V: 'a> Debug for VacantEntry<'a, K, V> {
473+
impl<K: Debug + Ord, V> Debug for VacantEntry<'_, K, V> {
474474
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
475475
f.debug_tuple("VacantEntry")
476476
.field(self.key())
@@ -493,7 +493,7 @@ pub struct OccupiedEntry<'a, K: 'a, V: 'a> {
493493
}
494494

495495
#[stable(feature= "debug_btree_map", since = "1.12.0")]
496-
impl<'a, K: 'a + Debug + Ord, V: 'a + Debug> Debug for OccupiedEntry<'a, K, V> {
496+
impl<K: Debug + Ord, V: Debug> Debug for OccupiedEntry<'_, K, V> {
497497
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
498498
f.debug_struct("OccupiedEntry")
499499
.field("key", self.key())
@@ -1202,7 +1202,7 @@ impl<'a, K: 'a, V: 'a> Iterator for Iter<'a, K, V> {
12021202
}
12031203

12041204
#[stable(feature = "fused", since = "1.26.0")]
1205-
impl<'a, K, V> FusedIterator for Iter<'a, K, V> {}
1205+
impl<K, V> FusedIterator for Iter<'_, K, V> {}
12061206

12071207
#[stable(feature = "rust1", since = "1.0.0")]
12081208
impl<'a, K: 'a, V: 'a> DoubleEndedIterator for Iter<'a, K, V> {
@@ -1217,7 +1217,7 @@ impl<'a, K: 'a, V: 'a> DoubleEndedIterator for Iter<'a, K, V> {
12171217
}
12181218

12191219
#[stable(feature = "rust1", since = "1.0.0")]
1220-
impl<'a, K: 'a, V: 'a> ExactSizeIterator for Iter<'a, K, V> {
1220+
impl<K, V> ExactSizeIterator for Iter<'_, K, V> {
12211221
fn len(&self) -> usize {
12221222
self.length
12231223
}
@@ -1274,14 +1274,14 @@ impl<'a, K: 'a, V: 'a> DoubleEndedIterator for IterMut<'a, K, V> {
12741274
}
12751275

12761276
#[stable(feature = "rust1", since = "1.0.0")]
1277-
impl<'a, K: 'a, V: 'a> ExactSizeIterator for IterMut<'a, K, V> {
1277+
impl<K, V> ExactSizeIterator for IterMut<'_, K, V> {
12781278
fn len(&self) -> usize {
12791279
self.length
12801280
}
12811281
}
12821282

12831283
#[stable(feature = "fused", since = "1.26.0")]
1284-
impl<'a, K, V> FusedIterator for IterMut<'a, K, V> {}
1284+
impl<K, V> FusedIterator for IterMut<'_, K, V> {}
12851285

12861286
#[stable(feature = "rust1", since = "1.0.0")]
12871287
impl<K, V> IntoIterator for BTreeMap<K, V> {
@@ -1437,14 +1437,14 @@ impl<'a, K, V> DoubleEndedIterator for Keys<'a, K, V> {
14371437
}
14381438

14391439
#[stable(feature = "rust1", since = "1.0.0")]
1440-
impl<'a, K, V> ExactSizeIterator for Keys<'a, K, V> {
1440+
impl<K, V> ExactSizeIterator for Keys<'_, K, V> {
14411441
fn len(&self) -> usize {
14421442
self.inner.len()
14431443
}
14441444
}
14451445

14461446
#[stable(feature = "fused", since = "1.26.0")]
1447-
impl<'a, K, V> FusedIterator for Keys<'a, K, V> {}
1447+
impl<K, V> FusedIterator for Keys<'_, K, V> {}
14481448

14491449
#[stable(feature = "rust1", since = "1.0.0")]
14501450
impl<'a, K, V> Clone for Keys<'a, K, V> {
@@ -1474,14 +1474,14 @@ impl<'a, K, V> DoubleEndedIterator for Values<'a, K, V> {
14741474
}
14751475

14761476
#[stable(feature = "rust1", since = "1.0.0")]
1477-
impl<'a, K, V> ExactSizeIterator for Values<'a, K, V> {
1477+
impl<K, V> ExactSizeIterator for Values<'_, K, V> {
14781478
fn len(&self) -> usize {
14791479
self.inner.len()
14801480
}
14811481
}
14821482

14831483
#[stable(feature = "fused", since = "1.26.0")]
1484-
impl<'a, K, V> FusedIterator for Values<'a, K, V> {}
1484+
impl<K, V> FusedIterator for Values<'_, K, V> {}
14851485

14861486
#[stable(feature = "rust1", since = "1.0.0")]
14871487
impl<'a, K, V> Clone for Values<'a, K, V> {
@@ -1524,15 +1524,14 @@ impl<'a, K, V> DoubleEndedIterator for ValuesMut<'a, K, V> {
15241524
}
15251525

15261526
#[stable(feature = "map_values_mut", since = "1.10.0")]
1527-
impl<'a, K, V> ExactSizeIterator for ValuesMut<'a, K, V> {
1527+
impl<K, V> ExactSizeIterator for ValuesMut<'_, K, V> {
15281528
fn len(&self) -> usize {
15291529
self.inner.len()
15301530
}
15311531
}
15321532

15331533
#[stable(feature = "fused", since = "1.26.0")]
1534-
impl<'a, K, V> FusedIterator for ValuesMut<'a, K, V> {}
1535-
1534+
impl<K, V> FusedIterator for ValuesMut<'_, K, V> {}
15361535

15371536
impl<'a, K, V> Range<'a, K, V> {
15381537
unsafe fn next_unchecked(&mut self) -> (&'a K, &'a V) {
@@ -1610,7 +1609,7 @@ impl<'a, K, V> Range<'a, K, V> {
16101609
}
16111610

16121611
#[stable(feature = "fused", since = "1.26.0")]
1613-
impl<'a, K, V> FusedIterator for Range<'a, K, V> {}
1612+
impl<K, V> FusedIterator for Range<'_, K, V> {}
16141613

16151614
#[stable(feature = "btree_range", since = "1.17.0")]
16161615
impl<'a, K, V> Clone for Range<'a, K, V> {
@@ -1679,7 +1678,7 @@ impl<'a, K, V> DoubleEndedIterator for RangeMut<'a, K, V> {
16791678
}
16801679

16811680
#[stable(feature = "fused", since = "1.26.0")]
1682-
impl<'a, K, V> FusedIterator for RangeMut<'a, K, V> {}
1681+
impl<K, V> FusedIterator for RangeMut<'_, K, V> {}
16831682

16841683
impl<'a, K, V> RangeMut<'a, K, V> {
16851684
unsafe fn next_back_unchecked(&mut self) -> (&'a K, &'a mut V) {
@@ -1790,7 +1789,7 @@ impl<K: Debug, V: Debug> Debug for BTreeMap<K, V> {
17901789
}
17911790

17921791
#[stable(feature = "rust1", since = "1.0.0")]
1793-
impl<'a, K: Ord, Q: ?Sized, V> Index<&'a Q> for BTreeMap<K, V>
1792+
impl<K: Ord, Q: ?Sized, V> Index<&Q> for BTreeMap<K, V>
17941793
where K: Borrow<Q>,
17951794
Q: Ord
17961795
{

0 commit comments

Comments
 (0)