diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-02-02 12:23:15 +0100 |
|---|---|---|
| committer | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-02-02 12:23:15 +0100 |
| commit | e70c2fbd5cbe8bf176f1ed01ba9a53cec7e842a5 (patch) | |
| tree | df0f306048f4d711a4fd090c294a3606e750ae9e /src/liballoc | |
| parent | 748970dfa9c12c1a09da4ff3ec724e4dbf7e796d (diff) | |
| download | rust-e70c2fbd5cbe8bf176f1ed01ba9a53cec7e842a5.tar.gz rust-e70c2fbd5cbe8bf176f1ed01ba9a53cec7e842a5.zip | |
liballoc: elide some lifetimes.
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/borrow.rs | 20 | ||||
| -rw-r--r-- | src/liballoc/boxed.rs | 4 | ||||
| -rw-r--r-- | src/liballoc/collections/binary_heap.rs | 24 | ||||
| -rw-r--r-- | src/liballoc/collections/btree/map.rs | 43 | ||||
| -rw-r--r-- | src/liballoc/collections/btree/set.rs | 32 | ||||
| -rw-r--r-- | src/liballoc/collections/linked_list.rs | 22 | ||||
| -rw-r--r-- | src/liballoc/collections/vec_deque.rs | 42 | ||||
| -rw-r--r-- | src/liballoc/string.rs | 20 | ||||
| -rw-r--r-- | src/liballoc/sync.rs | 4 | ||||
| -rw-r--r-- | src/liballoc/tests/vec.rs | 2 | ||||
| -rw-r--r-- | src/liballoc/tests/vec_deque.rs | 2 | ||||
| -rw-r--r-- | src/liballoc/vec.rs | 30 |
12 files changed, 119 insertions, 126 deletions
diff --git a/src/liballoc/borrow.rs b/src/liballoc/borrow.rs index c1696005373..816cdbc9ce6 100644 --- a/src/liballoc/borrow.rs +++ b/src/liballoc/borrow.rs @@ -183,9 +183,7 @@ pub enum Cow<'a, B: ?Sized + 'a> } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, B: ?Sized> Clone for Cow<'a, B> - where B: ToOwned -{ +impl<'a, B: ?Sized + ToOwned> Clone for Cow<'a, B> { fn clone(&self) -> Cow<'a, B> { match *self { Borrowed(b) => Borrowed(b), @@ -208,9 +206,7 @@ impl<'a, B: ?Sized> Clone for Cow<'a, B> } } -impl<'a, B: ?Sized> Cow<'a, B> - where B: ToOwned -{ +impl<B: ?Sized + ToOwned> Cow<'_, B> { /// Acquires a mutable reference to the owned form of the data. /// /// Clones the data if it is not already owned. @@ -286,9 +282,7 @@ impl<'a, B: ?Sized> Cow<'a, B> } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, B: ?Sized> Deref for Cow<'a, B> - where B: ToOwned -{ +impl<B: ?Sized + ToOwned> Deref for Cow<'_, B> { type Target = B; fn deref(&self) -> &B { @@ -300,7 +294,7 @@ impl<'a, B: ?Sized> Deref for Cow<'a, B> } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, B: ?Sized> Eq for Cow<'a, B> where B: Eq + ToOwned {} +impl<B: ?Sized> Eq for Cow<'_, B> where B: Eq + ToOwned {} #[stable(feature = "rust1", since = "1.0.0")] impl<'a, B: ?Sized> Ord for Cow<'a, B> @@ -334,7 +328,7 @@ impl<'a, B: ?Sized> PartialOrd for Cow<'a, B> } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, B: ?Sized> fmt::Debug for Cow<'a, B> +impl<B: ?Sized> fmt::Debug for Cow<'_, B> where B: fmt::Debug + ToOwned, <B as ToOwned>::Owned: fmt::Debug { @@ -347,7 +341,7 @@ impl<'a, B: ?Sized> fmt::Debug for Cow<'a, B> } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, B: ?Sized> fmt::Display for Cow<'a, B> +impl<B: ?Sized> fmt::Display for Cow<'_, B> where B: fmt::Display + ToOwned, <B as ToOwned>::Owned: fmt::Display { @@ -381,7 +375,7 @@ impl<'a, B: ?Sized> Hash for Cow<'a, B> } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T: ?Sized + ToOwned> AsRef<T> for Cow<'a, T> { +impl<T: ?Sized + ToOwned> AsRef<T> for Cow<'_, T> { fn as_ref(&self) -> &T { self } diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index f590b6488d9..6f6fff0a657 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -739,7 +739,7 @@ impl<A, F> FnBox<A> for F #[unstable(feature = "fnbox", reason = "will be deprecated if and when `Box<FnOnce>` becomes usable", issue = "28796")] -impl<'a, A, R> FnOnce<A> for Box<dyn FnBox<A, Output = R> + 'a> { +impl<A, R> FnOnce<A> for Box<dyn FnBox<A, Output = R> + '_> { type Output = R; 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> { #[unstable(feature = "fnbox", reason = "will be deprecated if and when `Box<FnOnce>` becomes usable", issue = "28796")] -impl<'a, A, R> FnOnce<A> for Box<dyn FnBox<A, Output = R> + Send + 'a> { +impl<A, R> FnOnce<A> for Box<dyn FnBox<A, Output = R> + Send + '_> { type Output = R; extern "rust-call" fn call_once(self, args: A) -> R { diff --git a/src/liballoc/collections/binary_heap.rs b/src/liballoc/collections/binary_heap.rs index 4a38f041636..43416e57591 100644 --- a/src/liballoc/collections/binary_heap.rs +++ b/src/liballoc/collections/binary_heap.rs @@ -231,7 +231,7 @@ pub struct PeekMut<'a, T: 'a + Ord> { } #[stable(feature = "collection_debug", since = "1.17.0")] -impl<'a, T: Ord + fmt::Debug> fmt::Debug for PeekMut<'a, T> { +impl<T: Ord + fmt::Debug> fmt::Debug for PeekMut<'_, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_tuple("PeekMut") .field(&self.heap.data[0]) @@ -240,7 +240,7 @@ impl<'a, T: Ord + fmt::Debug> fmt::Debug for PeekMut<'a, T> { } #[stable(feature = "binary_heap_peek_mut", since = "1.12.0")] -impl<'a, T: Ord> Drop for PeekMut<'a, T> { +impl<T: Ord> Drop for PeekMut<'_, T> { fn drop(&mut self) { if self.sift { self.heap.sift_down(0); @@ -249,7 +249,7 @@ impl<'a, T: Ord> Drop for PeekMut<'a, T> { } #[stable(feature = "binary_heap_peek_mut", since = "1.12.0")] -impl<'a, T: Ord> Deref for PeekMut<'a, T> { +impl<T: Ord> Deref for PeekMut<'_, T> { type Target = T; fn deref(&self) -> &T { &self.heap.data[0] @@ -257,7 +257,7 @@ impl<'a, T: Ord> Deref for PeekMut<'a, T> { } #[stable(feature = "binary_heap_peek_mut", since = "1.12.0")] -impl<'a, T: Ord> DerefMut for PeekMut<'a, T> { +impl<T: Ord> DerefMut for PeekMut<'_, T> { fn deref_mut(&mut self) -> &mut T { &mut self.heap.data[0] } @@ -912,7 +912,7 @@ impl<'a, T> Hole<'a, T> { } } -impl<'a, T> Drop for Hole<'a, T> { +impl<T> Drop for Hole<'_, T> { #[inline] fn drop(&mut self) { // fill the hole again @@ -936,7 +936,7 @@ pub struct Iter<'a, T: 'a> { } #[stable(feature = "collection_debug", since = "1.17.0")] -impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> { +impl<T: fmt::Debug> fmt::Debug for Iter<'_, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_tuple("Iter") .field(&self.iter.as_slice()) @@ -976,14 +976,14 @@ impl<'a, T> DoubleEndedIterator for Iter<'a, T> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T> ExactSizeIterator for Iter<'a, T> { +impl<T> ExactSizeIterator for Iter<'_, T> { fn is_empty(&self) -> bool { self.iter.is_empty() } } #[stable(feature = "fused", since = "1.26.0")] -impl<'a, T> FusedIterator for Iter<'a, T> {} +impl<T> FusedIterator for Iter<'_, T> {} /// An owning iterator over the elements of a `BinaryHeap`. /// @@ -1054,7 +1054,7 @@ pub struct Drain<'a, T: 'a> { } #[stable(feature = "drain", since = "1.6.0")] -impl<'a, T: 'a> Iterator for Drain<'a, T> { +impl<T> Iterator for Drain<'_, T> { type Item = T; #[inline] @@ -1069,7 +1069,7 @@ impl<'a, T: 'a> Iterator for Drain<'a, T> { } #[stable(feature = "drain", since = "1.6.0")] -impl<'a, T: 'a> DoubleEndedIterator for Drain<'a, T> { +impl<T> DoubleEndedIterator for Drain<'_, T> { #[inline] fn next_back(&mut self) -> Option<T> { self.iter.next_back() @@ -1077,14 +1077,14 @@ impl<'a, T: 'a> DoubleEndedIterator for Drain<'a, T> { } #[stable(feature = "drain", since = "1.6.0")] -impl<'a, T: 'a> ExactSizeIterator for Drain<'a, T> { +impl<T> ExactSizeIterator for Drain<'_, T> { fn is_empty(&self) -> bool { self.iter.is_empty() } } #[stable(feature = "fused", since = "1.26.0")] -impl<'a, T: 'a> FusedIterator for Drain<'a, T> {} +impl<T> FusedIterator for Drain<'_, T> {} #[stable(feature = "binary_heap_extras_15", since = "1.5.0")] impl<T: Ord> From<Vec<T>> for BinaryHeap<T> { diff --git a/src/liballoc/collections/btree/map.rs b/src/liballoc/collections/btree/map.rs index d0e35c557a4..27f162b1147 100644 --- a/src/liballoc/collections/btree/map.rs +++ b/src/liballoc/collections/btree/map.rs @@ -279,7 +279,7 @@ pub struct Iter<'a, K: 'a, V: 'a> { } #[stable(feature = "collection_debug", since = "1.17.0")] -impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Iter<'a, K, V> { +impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for Iter<'_, K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_list().entries(self.clone()).finish() } @@ -337,7 +337,7 @@ pub struct Keys<'a, K: 'a, V: 'a> { } #[stable(feature = "collection_debug", since = "1.17.0")] -impl<'a, K: 'a + fmt::Debug, V: 'a> fmt::Debug for Keys<'a, K, V> { +impl<K: fmt::Debug, V> fmt::Debug for Keys<'_, K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_list().entries(self.clone()).finish() } @@ -356,7 +356,7 @@ pub struct Values<'a, K: 'a, V: 'a> { } #[stable(feature = "collection_debug", since = "1.17.0")] -impl<'a, K: 'a, V: 'a + fmt::Debug> fmt::Debug for Values<'a, K, V> { +impl<K, V: fmt::Debug> fmt::Debug for Values<'_, K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_list().entries(self.clone()).finish() } @@ -389,7 +389,7 @@ pub struct Range<'a, K: 'a, V: 'a> { } #[stable(feature = "collection_debug", since = "1.17.0")] -impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Range<'a, K, V> { +impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for Range<'_, K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_list().entries(self.clone()).finish() } @@ -412,7 +412,7 @@ pub struct RangeMut<'a, K: 'a, V: 'a> { } #[stable(feature = "collection_debug", since = "1.17.0")] -impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for RangeMut<'a, K, V> { +impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for RangeMut<'_, K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let range = Range { front: self.front.reborrow(), @@ -442,7 +442,7 @@ pub enum Entry<'a, K: 'a, V: 'a> { } #[stable(feature= "debug_btree_map", since = "1.12.0")] -impl<'a, K: 'a + Debug + Ord, V: 'a + Debug> Debug for Entry<'a, K, V> { +impl<K: Debug + Ord, V: Debug> Debug for Entry<'_, K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { Vacant(ref v) => f.debug_tuple("Entry") @@ -470,7 +470,7 @@ pub struct VacantEntry<'a, K: 'a, V: 'a> { } #[stable(feature= "debug_btree_map", since = "1.12.0")] -impl<'a, K: 'a + Debug + Ord, V: 'a> Debug for VacantEntry<'a, K, V> { +impl<K: Debug + Ord, V> Debug for VacantEntry<'_, K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_tuple("VacantEntry") .field(self.key()) @@ -493,7 +493,7 @@ pub struct OccupiedEntry<'a, K: 'a, V: 'a> { } #[stable(feature= "debug_btree_map", since = "1.12.0")] -impl<'a, K: 'a + Debug + Ord, V: 'a + Debug> Debug for OccupiedEntry<'a, K, V> { +impl<K: Debug + Ord, V: Debug> Debug for OccupiedEntry<'_, K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("OccupiedEntry") .field("key", self.key()) @@ -1202,7 +1202,7 @@ impl<'a, K: 'a, V: 'a> Iterator for Iter<'a, K, V> { } #[stable(feature = "fused", since = "1.26.0")] -impl<'a, K, V> FusedIterator for Iter<'a, K, V> {} +impl<K, V> FusedIterator for Iter<'_, K, V> {} #[stable(feature = "rust1", since = "1.0.0")] 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> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, K: 'a, V: 'a> ExactSizeIterator for Iter<'a, K, V> { +impl<K, V> ExactSizeIterator for Iter<'_, K, V> { fn len(&self) -> usize { self.length } @@ -1274,14 +1274,14 @@ impl<'a, K: 'a, V: 'a> DoubleEndedIterator for IterMut<'a, K, V> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, K: 'a, V: 'a> ExactSizeIterator for IterMut<'a, K, V> { +impl<K, V> ExactSizeIterator for IterMut<'_, K, V> { fn len(&self) -> usize { self.length } } #[stable(feature = "fused", since = "1.26.0")] -impl<'a, K, V> FusedIterator for IterMut<'a, K, V> {} +impl<K, V> FusedIterator for IterMut<'_, K, V> {} #[stable(feature = "rust1", since = "1.0.0")] impl<K, V> IntoIterator for BTreeMap<K, V> { @@ -1437,14 +1437,14 @@ impl<'a, K, V> DoubleEndedIterator for Keys<'a, K, V> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, K, V> ExactSizeIterator for Keys<'a, K, V> { +impl<K, V> ExactSizeIterator for Keys<'_, K, V> { fn len(&self) -> usize { self.inner.len() } } #[stable(feature = "fused", since = "1.26.0")] -impl<'a, K, V> FusedIterator for Keys<'a, K, V> {} +impl<K, V> FusedIterator for Keys<'_, K, V> {} #[stable(feature = "rust1", since = "1.0.0")] impl<'a, K, V> Clone for Keys<'a, K, V> { @@ -1474,14 +1474,14 @@ impl<'a, K, V> DoubleEndedIterator for Values<'a, K, V> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, K, V> ExactSizeIterator for Values<'a, K, V> { +impl<K, V> ExactSizeIterator for Values<'_, K, V> { fn len(&self) -> usize { self.inner.len() } } #[stable(feature = "fused", since = "1.26.0")] -impl<'a, K, V> FusedIterator for Values<'a, K, V> {} +impl<K, V> FusedIterator for Values<'_, K, V> {} #[stable(feature = "rust1", since = "1.0.0")] impl<'a, K, V> Clone for Values<'a, K, V> { @@ -1524,15 +1524,14 @@ impl<'a, K, V> DoubleEndedIterator for ValuesMut<'a, K, V> { } #[stable(feature = "map_values_mut", since = "1.10.0")] -impl<'a, K, V> ExactSizeIterator for ValuesMut<'a, K, V> { +impl<K, V> ExactSizeIterator for ValuesMut<'_, K, V> { fn len(&self) -> usize { self.inner.len() } } #[stable(feature = "fused", since = "1.26.0")] -impl<'a, K, V> FusedIterator for ValuesMut<'a, K, V> {} - +impl<K, V> FusedIterator for ValuesMut<'_, K, V> {} impl<'a, K, V> Range<'a, K, V> { unsafe fn next_unchecked(&mut self) -> (&'a K, &'a V) { @@ -1610,7 +1609,7 @@ impl<'a, K, V> Range<'a, K, V> { } #[stable(feature = "fused", since = "1.26.0")] -impl<'a, K, V> FusedIterator for Range<'a, K, V> {} +impl<K, V> FusedIterator for Range<'_, K, V> {} #[stable(feature = "btree_range", since = "1.17.0")] impl<'a, K, V> Clone for Range<'a, K, V> { @@ -1679,7 +1678,7 @@ impl<'a, K, V> DoubleEndedIterator for RangeMut<'a, K, V> { } #[stable(feature = "fused", since = "1.26.0")] -impl<'a, K, V> FusedIterator for RangeMut<'a, K, V> {} +impl<K, V> FusedIterator for RangeMut<'_, K, V> {} impl<'a, K, V> RangeMut<'a, K, V> { 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> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, K: Ord, Q: ?Sized, V> Index<&'a Q> for BTreeMap<K, V> +impl<K: Ord, Q: ?Sized, V> Index<&Q> for BTreeMap<K, V> where K: Borrow<Q>, Q: Ord { diff --git a/src/liballoc/collections/btree/set.rs b/src/liballoc/collections/btree/set.rs index 9231d2e67cf..9c50bd7e918 100644 --- a/src/liballoc/collections/btree/set.rs +++ b/src/liballoc/collections/btree/set.rs @@ -79,7 +79,7 @@ pub struct Iter<'a, T: 'a> { } #[stable(feature = "collection_debug", since = "1.17.0")] -impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> { +impl<T: fmt::Debug> fmt::Debug for Iter<'_, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_tuple("Iter") .field(&self.iter.clone()) @@ -127,7 +127,7 @@ pub struct Difference<'a, T: 'a> { } #[stable(feature = "collection_debug", since = "1.17.0")] -impl<'a, T: 'a + fmt::Debug> fmt::Debug for Difference<'a, T> { +impl<T: fmt::Debug> fmt::Debug for Difference<'_, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_tuple("Difference") .field(&self.a) @@ -150,7 +150,7 @@ pub struct SymmetricDifference<'a, T: 'a> { } #[stable(feature = "collection_debug", since = "1.17.0")] -impl<'a, T: 'a + fmt::Debug> fmt::Debug for SymmetricDifference<'a, T> { +impl<T: fmt::Debug> fmt::Debug for SymmetricDifference<'_, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_tuple("SymmetricDifference") .field(&self.a) @@ -173,7 +173,7 @@ pub struct Intersection<'a, T: 'a> { } #[stable(feature = "collection_debug", since = "1.17.0")] -impl<'a, T: 'a + fmt::Debug> fmt::Debug for Intersection<'a, T> { +impl<T: fmt::Debug> fmt::Debug for Intersection<'_, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_tuple("Intersection") .field(&self.a) @@ -196,7 +196,7 @@ pub struct Union<'a, T: 'a> { } #[stable(feature = "collection_debug", since = "1.17.0")] -impl<'a, T: 'a + fmt::Debug> fmt::Debug for Union<'a, T> { +impl<T: fmt::Debug> fmt::Debug for Union<'_, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_tuple("Union") .field(&self.a) @@ -812,7 +812,7 @@ impl<T: Ord> Default for BTreeSet<T> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, 'b, T: Ord + Clone> Sub<&'b BTreeSet<T>> for &'a BTreeSet<T> { +impl<T: Ord + Clone> Sub<&BTreeSet<T>> for &BTreeSet<T> { type Output = BTreeSet<T>; /// Returns the difference of `self` and `rhs` as a new `BTreeSet<T>`. @@ -835,7 +835,7 @@ impl<'a, 'b, T: Ord + Clone> Sub<&'b BTreeSet<T>> for &'a BTreeSet<T> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, 'b, T: Ord + Clone> BitXor<&'b BTreeSet<T>> for &'a BTreeSet<T> { +impl<T: Ord + Clone> BitXor<&BTreeSet<T>> for &BTreeSet<T> { type Output = BTreeSet<T>; /// Returns the symmetric difference of `self` and `rhs` as a new `BTreeSet<T>`. @@ -858,7 +858,7 @@ impl<'a, 'b, T: Ord + Clone> BitXor<&'b BTreeSet<T>> for &'a BTreeSet<T> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, 'b, T: Ord + Clone> BitAnd<&'b BTreeSet<T>> for &'a BTreeSet<T> { +impl<T: Ord + Clone> BitAnd<&BTreeSet<T>> for &BTreeSet<T> { type Output = BTreeSet<T>; /// Returns the intersection of `self` and `rhs` as a new `BTreeSet<T>`. @@ -881,7 +881,7 @@ impl<'a, 'b, T: Ord + Clone> BitAnd<&'b BTreeSet<T>> for &'a BTreeSet<T> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, 'b, T: Ord + Clone> BitOr<&'b BTreeSet<T>> for &'a BTreeSet<T> { +impl<T: Ord + Clone> BitOr<&BTreeSet<T>> for &BTreeSet<T> { type Output = BTreeSet<T>; /// Returns the union of `self` and `rhs` as a new `BTreeSet<T>`. @@ -934,12 +934,12 @@ impl<'a, T> DoubleEndedIterator for Iter<'a, T> { } } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T> ExactSizeIterator for Iter<'a, T> { +impl<T> ExactSizeIterator for Iter<'_, T> { fn len(&self) -> usize { self.iter.len() } } #[stable(feature = "fused", since = "1.26.0")] -impl<'a, T> FusedIterator for Iter<'a, T> {} +impl<T> FusedIterator for Iter<'_, T> {} #[stable(feature = "rust1", since = "1.0.0")] impl<T> Iterator for IntoIter<T> { @@ -990,7 +990,7 @@ impl<'a, T> DoubleEndedIterator for Range<'a, T> { } #[stable(feature = "fused", since = "1.26.0")] -impl<'a, T> FusedIterator for Range<'a, T> {} +impl<T> FusedIterator for Range<'_, T> {} /// Compare `x` and `y`, but return `short` if x is None and `long` if y is None fn cmp_opt<T: Ord>(x: Option<&T>, y: Option<&T>, short: Ordering, long: Ordering) -> Ordering { @@ -1037,7 +1037,7 @@ impl<'a, T: Ord> Iterator for Difference<'a, T> { } #[stable(feature = "fused", since = "1.26.0")] -impl<'a, T: Ord> FusedIterator for Difference<'a, T> {} +impl<T: Ord> FusedIterator for Difference<'_, T> {} #[stable(feature = "rust1", since = "1.0.0")] impl<'a, T> Clone for SymmetricDifference<'a, T> { @@ -1071,7 +1071,7 @@ impl<'a, T: Ord> Iterator for SymmetricDifference<'a, T> { } #[stable(feature = "fused", since = "1.26.0")] -impl<'a, T: Ord> FusedIterator for SymmetricDifference<'a, T> {} +impl<T: Ord> FusedIterator for SymmetricDifference<'_, T> {} #[stable(feature = "rust1", since = "1.0.0")] impl<'a, T> Clone for Intersection<'a, T> { @@ -1109,7 +1109,7 @@ impl<'a, T: Ord> Iterator for Intersection<'a, T> { } #[stable(feature = "fused", since = "1.26.0")] -impl<'a, T: Ord> FusedIterator for Intersection<'a, T> {} +impl<T: Ord> FusedIterator for Intersection<'_, T> {} #[stable(feature = "rust1", since = "1.0.0")] impl<'a, T> Clone for Union<'a, T> { @@ -1143,4 +1143,4 @@ impl<'a, T: Ord> Iterator for Union<'a, T> { } #[stable(feature = "fused", since = "1.26.0")] -impl<'a, T: Ord> FusedIterator for Union<'a, T> {} +impl<T: Ord> FusedIterator for Union<'_, T> {} diff --git a/src/liballoc/collections/linked_list.rs b/src/liballoc/collections/linked_list.rs index 8f72c6babaf..e2da0041b4a 100644 --- a/src/liballoc/collections/linked_list.rs +++ b/src/liballoc/collections/linked_list.rs @@ -63,7 +63,7 @@ pub struct Iter<'a, T: 'a> { } #[stable(feature = "collection_debug", since = "1.17.0")] -impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> { +impl<T: fmt::Debug> fmt::Debug for Iter<'_, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_tuple("Iter") .field(&self.len) @@ -73,7 +73,7 @@ impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> { // FIXME(#26925) Remove in favor of `#[derive(Clone)]` #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T> Clone for Iter<'a, T> { +impl<T> Clone for Iter<'_, T> { fn clone(&self) -> Self { Iter { ..*self } } @@ -95,7 +95,7 @@ pub struct IterMut<'a, T: 'a> { } #[stable(feature = "collection_debug", since = "1.17.0")] -impl<'a, T: 'a + fmt::Debug> fmt::Debug for IterMut<'a, T> { +impl<T: fmt::Debug> fmt::Debug for IterMut<'_, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_tuple("IterMut") .field(&self.list) @@ -834,10 +834,10 @@ impl<'a, T> DoubleEndedIterator for Iter<'a, T> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T> ExactSizeIterator for Iter<'a, T> {} +impl<T> ExactSizeIterator for Iter<'_, T> {} #[stable(feature = "fused", since = "1.26.0")] -impl<'a, T> FusedIterator for Iter<'a, T> {} +impl<T> FusedIterator for Iter<'_, T> {} #[stable(feature = "rust1", since = "1.0.0")] impl<'a, T> Iterator for IterMut<'a, T> { @@ -883,12 +883,12 @@ impl<'a, T> DoubleEndedIterator for IterMut<'a, T> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T> ExactSizeIterator for IterMut<'a, T> {} +impl<T> ExactSizeIterator for IterMut<'_, T> {} #[stable(feature = "fused", since = "1.26.0")] -impl<'a, T> FusedIterator for IterMut<'a, T> {} +impl<T> FusedIterator for IterMut<'_, T> {} -impl<'a, T> IterMut<'a, T> { +impl<T> IterMut<'_, T> { /// Inserts the given element just after the element most recently returned by `.next()`. /// The inserted element does not appear in the iteration. /// @@ -984,7 +984,7 @@ pub struct DrainFilter<'a, T: 'a, F: 'a> } #[unstable(feature = "drain_filter", reason = "recently added", issue = "43244")] -impl<'a, T, F> Iterator for DrainFilter<'a, T, F> +impl<T, F> Iterator for DrainFilter<'_, T, F> where F: FnMut(&mut T) -> bool, { type Item = T; @@ -1011,7 +1011,7 @@ impl<'a, T, F> Iterator for DrainFilter<'a, T, F> } #[unstable(feature = "drain_filter", reason = "recently added", issue = "43244")] -impl<'a, T, F> Drop for DrainFilter<'a, T, F> +impl<T, F> Drop for DrainFilter<'_, T, F> where F: FnMut(&mut T) -> bool, { fn drop(&mut self) { @@ -1020,7 +1020,7 @@ impl<'a, T, F> Drop for DrainFilter<'a, T, F> } #[unstable(feature = "drain_filter", reason = "recently added", issue = "43244")] -impl<'a, T: 'a + fmt::Debug, F> fmt::Debug for DrainFilter<'a, T, F> +impl<T: fmt::Debug, F> fmt::Debug for DrainFilter<'_, T, F> where F: FnMut(&mut T) -> bool { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { diff --git a/src/liballoc/collections/vec_deque.rs b/src/liballoc/collections/vec_deque.rs index de78783983d..abfb83d4139 100644 --- a/src/liballoc/collections/vec_deque.rs +++ b/src/liballoc/collections/vec_deque.rs @@ -2086,7 +2086,7 @@ trait RingSlices: Sized { } } -impl<'a, T> RingSlices for &'a [T] { +impl<T> RingSlices for &[T] { fn slice(self, from: usize, to: usize) -> Self { &self[from..to] } @@ -2095,7 +2095,7 @@ impl<'a, T> RingSlices for &'a [T] { } } -impl<'a, T> RingSlices for &'a mut [T] { +impl<T> RingSlices for &mut [T] { fn slice(self, from: usize, to: usize) -> Self { &mut self[from..to] } @@ -2126,7 +2126,7 @@ pub struct Iter<'a, T: 'a> { } #[stable(feature = "collection_debug", since = "1.17.0")] -impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> { +impl<T: fmt::Debug> fmt::Debug for Iter<'_, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let (front, back) = RingSlices::ring_slices(self.ring, self.head, self.tail); f.debug_tuple("Iter") @@ -2206,14 +2206,14 @@ impl<'a, T> DoubleEndedIterator for Iter<'a, T> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T> ExactSizeIterator for Iter<'a, T> { +impl<T> ExactSizeIterator for Iter<'_, T> { fn is_empty(&self) -> bool { self.head == self.tail } } #[stable(feature = "fused", since = "1.26.0")] -impl<'a, T> FusedIterator for Iter<'a, T> {} +impl<T> FusedIterator for Iter<'_, T> {} /// A mutable iterator over the elements of a `VecDeque`. @@ -2231,7 +2231,7 @@ pub struct IterMut<'a, T: 'a> { } #[stable(feature = "collection_debug", since = "1.17.0")] -impl<'a, T: 'a + fmt::Debug> fmt::Debug for IterMut<'a, T> { +impl<'a, T: fmt::Debug> fmt::Debug for IterMut<'_, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let (front, back) = RingSlices::ring_slices(&*self.ring, self.head, self.tail); f.debug_tuple("IterMut") @@ -2299,14 +2299,14 @@ impl<'a, T> DoubleEndedIterator for IterMut<'a, T> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T> ExactSizeIterator for IterMut<'a, T> { +impl<T> ExactSizeIterator for IterMut<'_, T> { fn is_empty(&self) -> bool { self.head == self.tail } } #[stable(feature = "fused", since = "1.26.0")] -impl<'a, T> FusedIterator for IterMut<'a, T> {} +impl<T> FusedIterator for IterMut<'_, T> {} /// An owning iterator over the elements of a `VecDeque`. /// @@ -2380,7 +2380,7 @@ pub struct Drain<'a, T: 'a> { } #[stable(feature = "collection_debug", since = "1.17.0")] -impl<'a, T: 'a + fmt::Debug> fmt::Debug for Drain<'a, T> { +impl<T: fmt::Debug> fmt::Debug for Drain<'_, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_tuple("Drain") .field(&self.after_tail) @@ -2391,12 +2391,12 @@ impl<'a, T: 'a + fmt::Debug> fmt::Debug for Drain<'a, T> { } #[stable(feature = "drain", since = "1.6.0")] -unsafe impl<'a, T: Sync> Sync for Drain<'a, T> {} +unsafe impl<T: Sync> Sync for Drain<'_, T> {} #[stable(feature = "drain", since = "1.6.0")] -unsafe impl<'a, T: Send> Send for Drain<'a, T> {} +unsafe impl<T: Send> Send for Drain<'_, T> {} #[stable(feature = "drain", since = "1.6.0")] -impl<'a, T: 'a> Drop for Drain<'a, T> { +impl<T> Drop for Drain<'_, T> { fn drop(&mut self) { self.for_each(drop); @@ -2443,7 +2443,7 @@ impl<'a, T: 'a> Drop for Drain<'a, T> { } #[stable(feature = "drain", since = "1.6.0")] -impl<'a, T: 'a> Iterator for Drain<'a, T> { +impl<T> Iterator for Drain<'_, T> { type Item = T; #[inline] @@ -2458,7 +2458,7 @@ impl<'a, T: 'a> Iterator for Drain<'a, T> { } #[stable(feature = "drain", since = "1.6.0")] -impl<'a, T: 'a> DoubleEndedIterator for Drain<'a, T> { +impl<T> DoubleEndedIterator for Drain<'_, T> { #[inline] fn next_back(&mut self) -> Option<T> { self.iter.next_back().map(|elt| unsafe { ptr::read(elt) }) @@ -2466,10 +2466,10 @@ impl<'a, T: 'a> DoubleEndedIterator for Drain<'a, T> { } #[stable(feature = "drain", since = "1.6.0")] -impl<'a, T: 'a> ExactSizeIterator for Drain<'a, T> {} +impl<T> ExactSizeIterator for Drain<'_, T> {} #[stable(feature = "fused", since = "1.26.0")] -impl<'a, T: 'a> FusedIterator for Drain<'a, T> {} +impl<T> FusedIterator for Drain<'_, T> {} #[stable(feature = "rust1", since = "1.0.0")] impl<A: PartialEq> PartialEq for VecDeque<A> { @@ -2519,7 +2519,7 @@ macro_rules! __impl_slice_eq1 { }; ($Lhs: ty, $Rhs: ty, $Bound: ident) => { #[stable(feature = "vec_deque_partial_eq_slice", since = "1.17.0")] - impl<'a, 'b, A: $Bound, B> PartialEq<$Rhs> for $Lhs where A: PartialEq<B> { + impl<A: $Bound, B> PartialEq<$Rhs> for $Lhs where A: PartialEq<B> { fn eq(&self, other: &$Rhs) -> bool { if self.len() != other.len() { return false; @@ -2533,15 +2533,15 @@ macro_rules! __impl_slice_eq1 { } __impl_slice_eq1! { VecDeque<A>, Vec<B> } -__impl_slice_eq1! { VecDeque<A>, &'b [B] } -__impl_slice_eq1! { VecDeque<A>, &'b mut [B] } +__impl_slice_eq1! { VecDeque<A>, &[B] } +__impl_slice_eq1! { VecDeque<A>, &mut [B] } macro_rules! array_impls { ($($N: expr)+) => { $( __impl_slice_eq1! { VecDeque<A>, [B; $N] } - __impl_slice_eq1! { VecDeque<A>, &'b [B; $N] } - __impl_slice_eq1! { VecDeque<A>, &'b mut [B; $N] } + __impl_slice_eq1! { VecDeque<A>, &[B; $N] } + __impl_slice_eq1! { VecDeque<A>, &mut [B; $N] } )+ } } diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs index d74a3f004a3..92d3e52d60c 100644 --- a/src/liballoc/string.rs +++ b/src/liballoc/string.rs @@ -1935,7 +1935,7 @@ impl hash::Hash for String { /// let c = a.to_string() + b; /// ``` #[stable(feature = "rust1", since = "1.0.0")] -impl<'a> Add<&'a str> for String { +impl Add<&str> for String { type Output = String; #[inline] @@ -1949,7 +1949,7 @@ impl<'a> Add<&'a str> for String { /// /// This has the same behavior as the [`push_str`][String::push_str] method. #[stable(feature = "stringaddassign", since = "1.12.0")] -impl<'a> AddAssign<&'a str> for String { +impl AddAssign<&str> for String { #[inline] fn add_assign(&mut self, other: &str) { self.push_str(other); @@ -2183,7 +2183,7 @@ impl ToString for str { } #[stable(feature = "cow_str_to_string_specialization", since = "1.17.0")] -impl<'a> ToString for Cow<'a, str> { +impl ToString for Cow<'_, str> { #[inline] fn to_string(&self) -> String { self[..].to_owned() @@ -2373,19 +2373,19 @@ pub struct Drain<'a> { } #[stable(feature = "collection_debug", since = "1.17.0")] -impl<'a> fmt::Debug for Drain<'a> { +impl fmt::Debug for Drain<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.pad("Drain { .. }") } } #[stable(feature = "drain", since = "1.6.0")] -unsafe impl<'a> Sync for Drain<'a> {} +unsafe impl Sync for Drain<'_> {} #[stable(feature = "drain", since = "1.6.0")] -unsafe impl<'a> Send for Drain<'a> {} +unsafe impl Send for Drain<'_> {} #[stable(feature = "drain", since = "1.6.0")] -impl<'a> Drop for Drain<'a> { +impl Drop for Drain<'_> { fn drop(&mut self) { unsafe { // Use Vec::drain. "Reaffirm" the bounds checks to avoid @@ -2399,7 +2399,7 @@ impl<'a> Drop for Drain<'a> { } #[stable(feature = "drain", since = "1.6.0")] -impl<'a> Iterator for Drain<'a> { +impl Iterator for Drain<'_> { type Item = char; #[inline] @@ -2413,7 +2413,7 @@ impl<'a> Iterator for Drain<'a> { } #[stable(feature = "drain", since = "1.6.0")] -impl<'a> DoubleEndedIterator for Drain<'a> { +impl DoubleEndedIterator for Drain<'_> { #[inline] fn next_back(&mut self) -> Option<char> { self.iter.next_back() @@ -2421,4 +2421,4 @@ impl<'a> DoubleEndedIterator for Drain<'a> { } #[stable(feature = "fused", since = "1.26.0")] -impl<'a> FusedIterator for Drain<'a> {} +impl FusedIterator for Drain<'_> {} diff --git a/src/liballoc/sync.rs b/src/liballoc/sync.rs index 5e7a26132cb..2512e27e316 100644 --- a/src/liballoc/sync.rs +++ b/src/liballoc/sync.rs @@ -1605,7 +1605,7 @@ impl<T> From<T> for Arc<T> { } #[stable(feature = "shared_from_slice", since = "1.21.0")] -impl<'a, T: Clone> From<&'a [T]> for Arc<[T]> { +impl<T: Clone> From<&[T]> for Arc<[T]> { #[inline] fn from(v: &[T]) -> Arc<[T]> { <Self as ArcFromSlice<T>>::from_slice(v) @@ -1613,7 +1613,7 @@ impl<'a, T: Clone> From<&'a [T]> for Arc<[T]> { } #[stable(feature = "shared_from_slice", since = "1.21.0")] -impl<'a> From<&'a str> for Arc<str> { +impl From<&str> for Arc<str> { #[inline] fn from(v: &str) -> Arc<str> { let arc = Arc::<[u8]>::from(v.as_bytes()); diff --git a/src/liballoc/tests/vec.rs b/src/liballoc/tests/vec.rs index b65c68d51a5..e8fea287e1c 100644 --- a/src/liballoc/tests/vec.rs +++ b/src/liballoc/tests/vec.rs @@ -10,7 +10,7 @@ struct DropCounter<'a> { count: &'a mut u32, } -impl<'a> Drop for DropCounter<'a> { +impl Drop for DropCounter<'_> { fn drop(&mut self) { *self.count += 1; } diff --git a/src/liballoc/tests/vec_deque.rs b/src/liballoc/tests/vec_deque.rs index 44183956d8f..313aa55a2b2 100644 --- a/src/liballoc/tests/vec_deque.rs +++ b/src/liballoc/tests/vec_deque.rs @@ -1003,7 +1003,7 @@ struct DropCounter<'a> { count: &'a mut u32, } -impl<'a> Drop for DropCounter<'a> { +impl Drop for DropCounter<'_> { fn drop(&mut self) { *self.count += 1; } diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs index 8e097206881..b43ba6cb57c 100644 --- a/src/liballoc/vec.rs +++ b/src/liballoc/vec.rs @@ -1481,7 +1481,7 @@ impl<'a> SetLenOnDrop<'a> { } } -impl<'a> Drop for SetLenOnDrop<'a> { +impl Drop for SetLenOnDrop<'_> { #[inline] fn drop(&mut self) { *self.len = self.local_len; @@ -2471,12 +2471,12 @@ impl<'a, T: 'a + fmt::Debug> fmt::Debug for Drain<'a, T> { } #[stable(feature = "drain", since = "1.6.0")] -unsafe impl<'a, T: Sync> Sync for Drain<'a, T> {} +unsafe impl<T: Sync> Sync for Drain<'_, T> {} #[stable(feature = "drain", since = "1.6.0")] -unsafe impl<'a, T: Send> Send for Drain<'a, T> {} +unsafe impl<T: Send> Send for Drain<'_, T> {} #[stable(feature = "drain", since = "1.6.0")] -impl<'a, T> Iterator for Drain<'a, T> { +impl<T> Iterator for Drain<'_, T> { type Item = T; #[inline] @@ -2490,7 +2490,7 @@ impl<'a, T> Iterator for Drain<'a, T> { } #[stable(feature = "drain", since = "1.6.0")] -impl<'a, T> DoubleEndedIterator for Drain<'a, T> { +impl<T> DoubleEndedIterator for Drain<'_, T> { #[inline] fn next_back(&mut self) -> Option<T> { self.iter.next_back().map(|elt| unsafe { ptr::read(elt as *const _) }) @@ -2498,7 +2498,7 @@ impl<'a, T> DoubleEndedIterator for Drain<'a, T> { } #[stable(feature = "drain", since = "1.6.0")] -impl<'a, T> Drop for Drain<'a, T> { +impl<T> Drop for Drain<'_, T> { fn drop(&mut self) { // exhaust self first self.for_each(drop); @@ -2522,14 +2522,14 @@ impl<'a, T> Drop for Drain<'a, T> { #[stable(feature = "drain", since = "1.6.0")] -impl<'a, T> ExactSizeIterator for Drain<'a, T> { +impl<T> ExactSizeIterator for Drain<'_, T> { fn is_empty(&self) -> bool { self.iter.is_empty() } } #[stable(feature = "fused", since = "1.26.0")] -impl<'a, T> FusedIterator for Drain<'a, T> {} +impl<T> FusedIterator for Drain<'_, T> {} /// A splicing iterator for `Vec`. /// @@ -2546,7 +2546,7 @@ pub struct Splice<'a, I: Iterator + 'a> { } #[stable(feature = "vec_splice", since = "1.21.0")] -impl<'a, I: Iterator> Iterator for Splice<'a, I> { +impl<I: Iterator> Iterator for Splice<'_, I> { type Item = I::Item; fn next(&mut self) -> Option<Self::Item> { @@ -2559,18 +2559,18 @@ impl<'a, I: Iterator> Iterator for Splice<'a, I> { } #[stable(feature = "vec_splice", since = "1.21.0")] -impl<'a, I: Iterator> DoubleEndedIterator for Splice<'a, I> { +impl<I: Iterator> DoubleEndedIterator for Splice<'_, I> { fn next_back(&mut self) -> Option<Self::Item> { self.drain.next_back() } } #[stable(feature = "vec_splice", since = "1.21.0")] -impl<'a, I: Iterator> ExactSizeIterator for Splice<'a, I> {} +impl<I: Iterator> ExactSizeIterator for Splice<'_, I> {} #[stable(feature = "vec_splice", since = "1.21.0")] -impl<'a, I: Iterator> Drop for Splice<'a, I> { +impl<I: Iterator> Drop for Splice<'_, I> { fn drop(&mut self) { self.drain.by_ref().for_each(drop); @@ -2611,7 +2611,7 @@ impl<'a, I: Iterator> Drop for Splice<'a, I> { } /// Private helper methods for `Splice::drop` -impl<'a, T> Drain<'a, T> { +impl<T> Drain<'_, T> { /// The range from `self.vec.len` to `self.tail_start` contains elements /// that have been moved out. /// Fill that range as much as possible with new elements from the `replace_with` iterator. @@ -2663,7 +2663,7 @@ pub struct DrainFilter<'a, T: 'a, F> } #[unstable(feature = "drain_filter", reason = "recently added", issue = "43244")] -impl<'a, T, F> Iterator for DrainFilter<'a, T, F> +impl<T, F> Iterator for DrainFilter<'_, T, F> where F: FnMut(&mut T) -> bool, { type Item = T; @@ -2697,7 +2697,7 @@ impl<'a, T, F> Iterator for DrainFilter<'a, T, F> } #[unstable(feature = "drain_filter", reason = "recently added", issue = "43244")] -impl<'a, T, F> Drop for DrainFilter<'a, T, F> +impl<T, F> Drop for DrainFilter<'_, T, F> where F: FnMut(&mut T) -> bool, { fn drop(&mut self) { |
