Skip to content

Commit 8edbf93

Browse files
committed
style: use more anonymous lifetimes
1 parent 041ee54 commit 8edbf93

File tree

5 files changed

+82
-82
lines changed

5 files changed

+82
-82
lines changed

src/map.rs

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -733,28 +733,28 @@ impl<'a, K, V> Iterator for Keys<'a, K, V> {
733733
iterator_methods!(Bucket::key_ref);
734734
}
735735

736-
impl<'a, K, V> DoubleEndedIterator for Keys<'a, K, V> {
737-
fn next_back(&mut self) -> Option<&'a K> {
736+
impl<K, V> DoubleEndedIterator for Keys<'_, K, V> {
737+
fn next_back(&mut self) -> Option<Self::Item> {
738738
self.iter.next_back().map(Bucket::key_ref)
739739
}
740740
}
741741

742-
impl<'a, K, V> ExactSizeIterator for Keys<'a, K, V> {
742+
impl<K, V> ExactSizeIterator for Keys<'_, K, V> {
743743
fn len(&self) -> usize {
744744
self.iter.len()
745745
}
746746
}
747747

748748
// FIXME(#26925) Remove in favor of `#[derive(Clone)]`
749-
impl<'a, K, V> Clone for Keys<'a, K, V> {
750-
fn clone(&self) -> Keys<'a, K, V> {
749+
impl<K, V> Clone for Keys<'_, K, V> {
750+
fn clone(&self) -> Self {
751751
Keys {
752752
iter: self.iter.clone(),
753753
}
754754
}
755755
}
756756

757-
impl<'a, K: fmt::Debug, V> fmt::Debug for Keys<'a, K, V> {
757+
impl<K: fmt::Debug, V> fmt::Debug for Keys<'_, K, V> {
758758
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
759759
f.debug_list().entries(self.clone()).finish()
760760
}
@@ -777,28 +777,28 @@ impl<'a, K, V> Iterator for Values<'a, K, V> {
777777
iterator_methods!(Bucket::value_ref);
778778
}
779779

780-
impl<'a, K, V> DoubleEndedIterator for Values<'a, K, V> {
780+
impl<K, V> DoubleEndedIterator for Values<'_, K, V> {
781781
fn next_back(&mut self) -> Option<Self::Item> {
782782
self.iter.next_back().map(Bucket::value_ref)
783783
}
784784
}
785785

786-
impl<'a, K, V> ExactSizeIterator for Values<'a, K, V> {
786+
impl<K, V> ExactSizeIterator for Values<'_, K, V> {
787787
fn len(&self) -> usize {
788788
self.iter.len()
789789
}
790790
}
791791

792792
// FIXME(#26925) Remove in favor of `#[derive(Clone)]`
793-
impl<'a, K, V> Clone for Values<'a, K, V> {
794-
fn clone(&self) -> Values<'a, K, V> {
793+
impl<K, V> Clone for Values<'_, K, V> {
794+
fn clone(&self) -> Self {
795795
Values {
796796
iter: self.iter.clone(),
797797
}
798798
}
799799
}
800800

801-
impl<'a, K, V: fmt::Debug> fmt::Debug for Values<'a, K, V> {
801+
impl<K, V: fmt::Debug> fmt::Debug for Values<'_, K, V> {
802802
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
803803
f.debug_list().entries(self.clone()).finish()
804804
}
@@ -821,13 +821,13 @@ impl<'a, K, V> Iterator for ValuesMut<'a, K, V> {
821821
iterator_methods!(Bucket::value_mut);
822822
}
823823

824-
impl<'a, K, V> DoubleEndedIterator for ValuesMut<'a, K, V> {
824+
impl<K, V> DoubleEndedIterator for ValuesMut<'_, K, V> {
825825
fn next_back(&mut self) -> Option<Self::Item> {
826826
self.iter.next_back().map(Bucket::value_mut)
827827
}
828828
}
829829

830-
impl<'a, K, V> ExactSizeIterator for ValuesMut<'a, K, V> {
830+
impl<K, V> ExactSizeIterator for ValuesMut<'_, K, V> {
831831
fn len(&self) -> usize {
832832
self.iter.len()
833833
}
@@ -850,28 +850,28 @@ impl<'a, K, V> Iterator for Iter<'a, K, V> {
850850
iterator_methods!(Bucket::refs);
851851
}
852852

853-
impl<'a, K, V> DoubleEndedIterator for Iter<'a, K, V> {
853+
impl<K, V> DoubleEndedIterator for Iter<'_, K, V> {
854854
fn next_back(&mut self) -> Option<Self::Item> {
855855
self.iter.next_back().map(Bucket::refs)
856856
}
857857
}
858858

859-
impl<'a, K, V> ExactSizeIterator for Iter<'a, K, V> {
859+
impl<K, V> ExactSizeIterator for Iter<'_, K, V> {
860860
fn len(&self) -> usize {
861861
self.iter.len()
862862
}
863863
}
864864

865865
// FIXME(#26925) Remove in favor of `#[derive(Clone)]`
866-
impl<'a, K, V> Clone for Iter<'a, K, V> {
867-
fn clone(&self) -> Iter<'a, K, V> {
866+
impl<K, V> Clone for Iter<'_, K, V> {
867+
fn clone(&self) -> Self {
868868
Iter {
869869
iter: self.iter.clone(),
870870
}
871871
}
872872
}
873873

874-
impl<'a, K: fmt::Debug, V: fmt::Debug> fmt::Debug for Iter<'a, K, V> {
874+
impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for Iter<'_, K, V> {
875875
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
876876
f.debug_list().entries(self.clone()).finish()
877877
}
@@ -894,13 +894,13 @@ impl<'a, K, V> Iterator for IterMut<'a, K, V> {
894894
iterator_methods!(Bucket::ref_mut);
895895
}
896896

897-
impl<'a, K, V> DoubleEndedIterator for IterMut<'a, K, V> {
897+
impl<K, V> DoubleEndedIterator for IterMut<'_, K, V> {
898898
fn next_back(&mut self) -> Option<Self::Item> {
899899
self.iter.next_back().map(Bucket::ref_mut)
900900
}
901901
}
902902

903-
impl<'a, K, V> ExactSizeIterator for IterMut<'a, K, V> {
903+
impl<K, V> ExactSizeIterator for IterMut<'_, K, V> {
904904
fn len(&self) -> usize {
905905
self.iter.len()
906906
}
@@ -923,7 +923,7 @@ impl<K, V> Iterator for IntoIter<K, V> {
923923
iterator_methods!(Bucket::key_value);
924924
}
925925

926-
impl<'a, K, V> DoubleEndedIterator for IntoIter<K, V> {
926+
impl<K, V> DoubleEndedIterator for IntoIter<K, V> {
927927
fn next_back(&mut self) -> Option<Self::Item> {
928928
self.iter.next_back().map(Bucket::key_value)
929929
}
@@ -953,13 +953,13 @@ pub struct Drain<'a, K, V> {
953953
pub(crate) iter: vec::Drain<'a, Bucket<K, V>>,
954954
}
955955

956-
impl<'a, K, V> Iterator for Drain<'a, K, V> {
956+
impl<K, V> Iterator for Drain<'_, K, V> {
957957
type Item = (K, V);
958958

959959
iterator_methods!(Bucket::key_value);
960960
}
961961

962-
impl<'a, K, V> DoubleEndedIterator for Drain<'a, K, V> {
962+
impl<K, V> DoubleEndedIterator for Drain<'_, K, V> {
963963
double_ended_iterator_methods!(Bucket::key_value);
964964
}
965965

@@ -1001,7 +1001,7 @@ where
10011001
}
10021002
}
10031003

1004-
impl<'a, K, V, Q: ?Sized, S> Index<&'a Q> for IndexMap<K, V, S>
1004+
impl<K, V, Q: ?Sized, S> Index<&Q> for IndexMap<K, V, S>
10051005
where
10061006
Q: Hash + Equivalent<K>,
10071007
K: Hash + Eq,
@@ -1010,7 +1010,7 @@ where
10101010
type Output = V;
10111011

10121012
/// ***Panics*** if `key` is not present in the map.
1013-
fn index(&self, key: &'a Q) -> &V {
1013+
fn index(&self, key: &Q) -> &V {
10141014
self.get(key).expect("IndexMap: key not found")
10151015
}
10161016
}
@@ -1019,14 +1019,14 @@ where
10191019
/// pairs that are already present.
10201020
///
10211021
/// You can **not** insert new pairs with index syntax, use `.insert()`.
1022-
impl<'a, K, V, Q: ?Sized, S> IndexMut<&'a Q> for IndexMap<K, V, S>
1022+
impl<K, V, Q: ?Sized, S> IndexMut<&Q> for IndexMap<K, V, S>
10231023
where
10241024
Q: Hash + Equivalent<K>,
10251025
K: Hash + Eq,
10261026
S: BuildHasher,
10271027
{
10281028
/// ***Panics*** if `key` is not present in the map.
1029-
fn index_mut(&mut self, key: &'a Q) -> &mut V {
1029+
fn index_mut(&mut self, key: &Q) -> &mut V {
10301030
self.get_mut(key).expect("IndexMap: key not found")
10311031
}
10321032
}

src/map/core.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ impl<'a, K, V> Entry<'a, K, V> {
296296
}
297297
}
298298

299-
impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Entry<'a, K, V> {
299+
impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for Entry<'_, K, V> {
300300
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
301301
match *self {
302302
Entry::Vacant(ref v) => f.debug_tuple(stringify!(Entry)).field(v).finish(),
@@ -308,7 +308,7 @@ impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Entry<'a, K, V>
308308
pub use self::raw::OccupiedEntry;
309309

310310
// Extra methods that don't threaten the unsafe encapsulation.
311-
impl<'a, K, V> OccupiedEntry<'a, K, V> {
311+
impl<K, V> OccupiedEntry<'_, K, V> {
312312
/// Sets the value of the entry to `value`, and returns the entry's old value.
313313
pub fn insert(&mut self, value: V) -> V {
314314
replace(self.get_mut(), value)
@@ -351,7 +351,7 @@ impl<'a, K, V> OccupiedEntry<'a, K, V> {
351351
}
352352
}
353353

354-
impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for OccupiedEntry<'a, K, V> {
354+
impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for OccupiedEntry<'_, K, V> {
355355
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
356356
f.debug_struct(stringify!(OccupiedEntry))
357357
.field("key", self.key())
@@ -390,7 +390,7 @@ impl<'a, K, V> VacantEntry<'a, K, V> {
390390
}
391391
}
392392

393-
impl<'a, K: 'a + fmt::Debug, V: 'a> fmt::Debug for VacantEntry<'a, K, V> {
393+
impl<K: fmt::Debug, V> fmt::Debug for VacantEntry<'_, K, V> {
394394
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
395395
f.debug_tuple(stringify!(VacantEntry))
396396
.field(self.key())

src/rayon/map.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,13 @@ pub struct ParIter<'a, K, V> {
9191
entries: &'a [Bucket<K, V>],
9292
}
9393

94-
impl<'a, K, V> Clone for ParIter<'a, K, V> {
95-
fn clone(&self) -> ParIter<'a, K, V> {
94+
impl<K, V> Clone for ParIter<'_, K, V> {
95+
fn clone(&self) -> Self {
9696
ParIter { ..*self }
9797
}
9898
}
9999

100-
impl<'a, K: fmt::Debug, V: fmt::Debug> fmt::Debug for ParIter<'a, K, V> {
100+
impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for ParIter<'_, K, V> {
101101
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
102102
let iter = self.entries.iter().map(Bucket::refs);
103103
f.debug_list().entries(iter).finish()
@@ -110,7 +110,7 @@ impl<'a, K: Sync, V: Sync> ParallelIterator for ParIter<'a, K, V> {
110110
parallel_iterator_methods!(Bucket::refs);
111111
}
112112

113-
impl<'a, K: Sync, V: Sync> IndexedParallelIterator for ParIter<'a, K, V> {
113+
impl<K: Sync, V: Sync> IndexedParallelIterator for ParIter<'_, K, V> {
114114
indexed_parallel_iterator_methods!(Bucket::refs);
115115
}
116116

@@ -148,7 +148,7 @@ impl<'a, K: Sync + Send, V: Send> ParallelIterator for ParIterMut<'a, K, V> {
148148
parallel_iterator_methods!(Bucket::ref_mut);
149149
}
150150

151-
impl<'a, K: Sync + Send, V: Send> IndexedParallelIterator for ParIterMut<'a, K, V> {
151+
impl<K: Sync + Send, V: Send> IndexedParallelIterator for ParIterMut<'_, K, V> {
152152
indexed_parallel_iterator_methods!(Bucket::ref_mut);
153153
}
154154

@@ -209,13 +209,13 @@ pub struct ParKeys<'a, K, V> {
209209
entries: &'a [Bucket<K, V>],
210210
}
211211

212-
impl<'a, K, V> Clone for ParKeys<'a, K, V> {
213-
fn clone(&self) -> ParKeys<'a, K, V> {
212+
impl<K, V> Clone for ParKeys<'_, K, V> {
213+
fn clone(&self) -> Self {
214214
ParKeys { ..*self }
215215
}
216216
}
217217

218-
impl<'a, K: fmt::Debug, V> fmt::Debug for ParKeys<'a, K, V> {
218+
impl<K: fmt::Debug, V> fmt::Debug for ParKeys<'_, K, V> {
219219
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
220220
let iter = self.entries.iter().map(Bucket::key_ref);
221221
f.debug_list().entries(iter).finish()
@@ -228,7 +228,7 @@ impl<'a, K: Sync, V: Sync> ParallelIterator for ParKeys<'a, K, V> {
228228
parallel_iterator_methods!(Bucket::key_ref);
229229
}
230230

231-
impl<'a, K: Sync, V: Sync> IndexedParallelIterator for ParKeys<'a, K, V> {
231+
impl<K: Sync, V: Sync> IndexedParallelIterator for ParKeys<'_, K, V> {
232232
indexed_parallel_iterator_methods!(Bucket::key_ref);
233233
}
234234

@@ -243,13 +243,13 @@ pub struct ParValues<'a, K, V> {
243243
entries: &'a [Bucket<K, V>],
244244
}
245245

246-
impl<'a, K, V> Clone for ParValues<'a, K, V> {
247-
fn clone(&self) -> ParValues<'a, K, V> {
246+
impl<K, V> Clone for ParValues<'_, K, V> {
247+
fn clone(&self) -> Self {
248248
ParValues { ..*self }
249249
}
250250
}
251251

252-
impl<'a, K, V: fmt::Debug> fmt::Debug for ParValues<'a, K, V> {
252+
impl<K, V: fmt::Debug> fmt::Debug for ParValues<'_, K, V> {
253253
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
254254
let iter = self.entries.iter().map(Bucket::value_ref);
255255
f.debug_list().entries(iter).finish()
@@ -262,7 +262,7 @@ impl<'a, K: Sync, V: Sync> ParallelIterator for ParValues<'a, K, V> {
262262
parallel_iterator_methods!(Bucket::value_ref);
263263
}
264264

265-
impl<'a, K: Sync, V: Sync> IndexedParallelIterator for ParValues<'a, K, V> {
265+
impl<K: Sync, V: Sync> IndexedParallelIterator for ParValues<'_, K, V> {
266266
indexed_parallel_iterator_methods!(Bucket::value_ref);
267267
}
268268

@@ -336,7 +336,7 @@ impl<'a, K: Send, V: Send> ParallelIterator for ParValuesMut<'a, K, V> {
336336
parallel_iterator_methods!(Bucket::value_mut);
337337
}
338338

339-
impl<'a, K: Send, V: Send> IndexedParallelIterator for ParValuesMut<'a, K, V> {
339+
impl<K: Send, V: Send> IndexedParallelIterator for ParValuesMut<'_, K, V> {
340340
indexed_parallel_iterator_methods!(Bucket::value_mut);
341341
}
342342

0 commit comments

Comments
 (0)