Skip to content

Commit c3c9978

Browse files
committed
table_seq: fix clippy warnings (needless lifetimes, unnecessary returns)
1 parent b7866fe commit c3c9978

File tree

6 files changed

+38
-38
lines changed

6 files changed

+38
-38
lines changed

table_seq/src/map_seq.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -228,13 +228,13 @@ pub struct MapSeqMap<'a, K, V, S> {
228228
map: usize,
229229
}
230230

231-
impl<'a, K, V, S> Clone for MapSeqMap<'a, K, V, S> {
231+
impl<K, V, S> Clone for MapSeqMap<'_, K, V, S> {
232232
fn clone(&self) -> Self {
233233
*self
234234
}
235235
}
236236

237-
impl<'a, K, V, S> Copy for MapSeqMap<'a, K, V, S> {}
237+
impl<K, V, S> Copy for MapSeqMap<'_, K, V, S> {}
238238

239239
impl<'a, K, V, S> std::ops::Deref for MapSeqMapMut<'a, K, V, S> {
240240
type Target = MapSeqMap<'a, K, V, S>;
@@ -246,13 +246,13 @@ impl<'a, K, V, S> std::ops::Deref for MapSeqMapMut<'a, K, V, S> {
246246
}
247247
}
248248

249-
impl<'a, K: fmt::Debug, V: fmt::Debug, S> fmt::Debug for MapSeqMap<'a, K, V, S> {
249+
impl<K: fmt::Debug, V: fmt::Debug, S> fmt::Debug for MapSeqMap<'_, K, V, S> {
250250
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
251251
f.debug_set().entries(self.iter()).finish()
252252
}
253253
}
254254

255-
impl<'a, K: fmt::Debug, V: fmt::Debug, S> fmt::Debug for MapSeqMapMut<'a, K, V, S> {
255+
impl<K: fmt::Debug, V: fmt::Debug, S> fmt::Debug for MapSeqMapMut<'_, K, V, S> {
256256
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
257257
f.debug_set().entries(self.iter()).finish()
258258
}
@@ -296,7 +296,7 @@ impl<'a, K, V, S> MapSeqMap<'a, K, V, S> {
296296
}
297297
}
298298

299-
impl<'a, K, V, S> MapSeqMapMut<'a, K, V, S> {
299+
impl<K, V, S> MapSeqMapMut<'_, K, V, S> {
300300
/// Discards all elements of the map.
301301
#[inline(always)]
302302
pub fn clear(&mut self) {
@@ -319,7 +319,7 @@ impl<'a, K, V, S> MapSeqMapMut<'a, K, V, S> {
319319
}
320320
}
321321

322-
impl<'a, K: Eq + Hash, V, S: BuildHasher> MapSeqMap<'a, K, V, S> {
322+
impl<K: Eq + Hash, V, S: BuildHasher> MapSeqMap<'_, K, V, S> {
323323
/// Returns `true` if the map contains an element for the given key.
324324
#[inline(always)]
325325
pub fn contains_key<Q>(&self, key: &Q) -> bool
@@ -353,7 +353,7 @@ impl<'a, K: Eq + Hash, V, S: BuildHasher> MapSeqMap<'a, K, V, S> {
353353
}
354354
}
355355

356-
impl<'a, K: Eq + Hash, V, S: BuildHasher> MapSeqMapMut<'a, K, V, S> {
356+
impl<K: Eq + Hash, V, S: BuildHasher> MapSeqMapMut<'_, K, V, S> {
357357
/// Returns a mutable reference to the value corresponding to the given key.
358358
#[inline(always)]
359359
pub fn get_mut<Q>(&mut self, key: &Q) -> Option<&mut V>
@@ -545,7 +545,7 @@ pub struct MapIter<'a, K, V> {
545545
inner: SubtableIter<'a, MapEntry<K, V>>,
546546
}
547547

548-
impl<'a, K, V> Default for MapIter<'a, K, V> {
548+
impl<K, V> Default for MapIter<'_, K, V> {
549549
#[inline(always)]
550550
fn default() -> Self {
551551
Self {
@@ -568,7 +568,7 @@ impl<'a, K, V> Iterator for MapIter<'a, K, V> {
568568
}
569569
}
570570

571-
impl<'a, K, V> ExactSizeIterator for MapIter<'a, K, V> {
571+
impl<K, V> ExactSizeIterator for MapIter<'_, K, V> {
572572
#[inline(always)]
573573
fn len(&self) -> usize {
574574
self.inner.len()
@@ -580,7 +580,7 @@ pub struct MapKeys<'a, K, V> {
580580
inner: SubtableIter<'a, MapEntry<K, V>>,
581581
}
582582

583-
impl<'a, K, V> Default for MapKeys<'a, K, V> {
583+
impl<K, V> Default for MapKeys<'_, K, V> {
584584
#[inline(always)]
585585
fn default() -> Self {
586586
Self {
@@ -603,7 +603,7 @@ impl<'a, K, V> Iterator for MapKeys<'a, K, V> {
603603
}
604604
}
605605

606-
impl<'a, K, V> ExactSizeIterator for MapKeys<'a, K, V> {
606+
impl<K, V> ExactSizeIterator for MapKeys<'_, K, V> {
607607
#[inline(always)]
608608
fn len(&self) -> usize {
609609
self.inner.len()
@@ -615,7 +615,7 @@ pub struct MapValues<'a, K, V> {
615615
inner: SubtableIter<'a, MapEntry<K, V>>,
616616
}
617617

618-
impl<'a, K, V> Default for MapValues<'a, K, V> {
618+
impl<K, V> Default for MapValues<'_, K, V> {
619619
#[inline(always)]
620620
fn default() -> Self {
621621
Self {
@@ -638,7 +638,7 @@ impl<'a, K, V> Iterator for MapValues<'a, K, V> {
638638
}
639639
}
640640

641-
impl<'a, K, V> ExactSizeIterator for MapValues<'a, K, V> {
641+
impl<K, V> ExactSizeIterator for MapValues<'_, K, V> {
642642
#[inline(always)]
643643
fn len(&self) -> usize {
644644
self.inner.len()
@@ -650,7 +650,7 @@ pub struct MapIterMut<'a, K, V> {
650650
inner: SubtableIterMut<'a, MapEntry<K, V>>,
651651
}
652652

653-
impl<'a, K, V> Default for MapIterMut<'a, K, V> {
653+
impl<K, V> Default for MapIterMut<'_, K, V> {
654654
#[inline(always)]
655655
fn default() -> Self {
656656
Self {
@@ -675,7 +675,7 @@ impl<'a, K, V> Iterator for MapIterMut<'a, K, V> {
675675
}
676676
}
677677

678-
impl<'a, K, V> ExactSizeIterator for MapIterMut<'a, K, V> {
678+
impl<K, V> ExactSizeIterator for MapIterMut<'_, K, V> {
679679
#[inline(always)]
680680
fn len(&self) -> usize {
681681
self.inner.len()
@@ -700,7 +700,7 @@ impl<'a, K, V, S> IntoIterator for MapSeqMapMut<'a, K, V, S> {
700700
}
701701
}
702702

703-
impl<'a, K, V, S> Extend<(K, V)> for MapSeqMapMut<'a, K, V, S>
703+
impl<K, V, S> Extend<(K, V)> for MapSeqMapMut<'_, K, V, S>
704704
where
705705
K: Eq + Hash,
706706
S: BuildHasher,
@@ -712,7 +712,7 @@ where
712712
}
713713
}
714714

715-
impl<'a, 'b, K, V, S> Extend<(&'b K, &'b V)> for MapSeqMapMut<'a, K, V, S>
715+
impl<'b, K, V, S> Extend<(&'b K, &'b V)> for MapSeqMapMut<'_, K, V, S>
716716
where
717717
K: Eq + Hash + Copy,
718718
V: Copy,
@@ -725,7 +725,7 @@ where
725725
}
726726
}
727727

728-
impl<'a, K, Q, V, S> std::ops::Index<&Q> for MapSeqMap<'a, K, V, S>
728+
impl<K, Q, V, S> std::ops::Index<&Q> for MapSeqMap<'_, K, V, S>
729729
where
730730
K: Eq + Hash + Borrow<Q>,
731731
S: BuildHasher,
@@ -738,7 +738,7 @@ where
738738
}
739739
}
740740

741-
impl<'a, K, Q, V, S> std::ops::Index<&Q> for MapSeqMapMut<'a, K, V, S>
741+
impl<K, Q, V, S> std::ops::Index<&Q> for MapSeqMapMut<'_, K, V, S>
742742
where
743743
K: Eq + Hash + Borrow<Q>,
744744
S: BuildHasher,

table_seq/src/set_seq.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub struct SetIter<'a, T> {
1313
inner: SubtableIter<'a, T>,
1414
}
1515

16-
impl<'a, T> Default for SetIter<'a, T> {
16+
impl<T> Default for SetIter<'_, T> {
1717
#[inline(always)]
1818
fn default() -> Self {
1919
Self {
@@ -36,7 +36,7 @@ impl<'a, T> Iterator for SetIter<'a, T> {
3636
}
3737
}
3838

39-
impl<'a, T> ExactSizeIterator for SetIter<'a, T> {
39+
impl<T> ExactSizeIterator for SetIter<'_, T> {
4040
#[inline(always)]
4141
fn len(&self) -> usize {
4242
self.inner.len()
@@ -273,13 +273,13 @@ impl<'a, T, S> std::ops::Deref for SetSeqSetMut<'a, T, S> {
273273
}
274274
}
275275

276-
impl<'a, T: fmt::Debug, S> fmt::Debug for SetSeqSet<'a, T, S> {
276+
impl<T: fmt::Debug, S> fmt::Debug for SetSeqSet<'_, T, S> {
277277
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
278278
f.debug_set().entries(self.iter()).finish()
279279
}
280280
}
281281

282-
impl<'a, T: fmt::Debug, S> fmt::Debug for SetSeqSetMut<'a, T, S> {
282+
impl<T: fmt::Debug, S> fmt::Debug for SetSeqSetMut<'_, T, S> {
283283
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
284284
f.debug_set().entries(self.iter()).finish()
285285
}
@@ -307,15 +307,15 @@ impl<'a, T, S> SetSeqSet<'a, T, S> {
307307
}
308308
}
309309

310-
impl<'a, T, S> SetSeqSetMut<'a, T, S> {
310+
impl<T, S> SetSeqSetMut<'_, T, S> {
311311
/// Discards all elements of the set.
312312
#[inline(always)]
313313
pub fn clear(&mut self) {
314314
self.seq.clear_set(self.set)
315315
}
316316
}
317317

318-
impl<'a, T: Eq + Hash, S: BuildHasher> SetSeqSet<'a, T, S> {
318+
impl<T: Eq + Hash, S: BuildHasher> SetSeqSet<'_, T, S> {
319319
/// Checks whether a given value is an element of the set.
320320
#[inline(always)]
321321
pub fn contains<Q>(&self, value: &Q) -> bool
@@ -337,7 +337,7 @@ impl<'a, T: Eq + Hash, S: BuildHasher> SetSeqSet<'a, T, S> {
337337
}
338338
}
339339

340-
impl<'a, T: Eq + Hash, S: BuildHasher> SetSeqSetMut<'a, T, S> {
340+
impl<T: Eq + Hash, S: BuildHasher> SetSeqSetMut<'_, T, S> {
341341
/// Inserts a value into the set.
342342
///
343343
/// If the value is already present, the given value is discarded and the set is not modified.

table_seq/src/table_seq.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ impl<T: fmt::Debug> fmt::Debug for TableSeq<T> {
6565
#[derive(Clone)]
6666
struct SubtableFmt<'a, T>(&'a TableSeq<T>, usize);
6767

68-
impl<'a, T: fmt::Debug> fmt::Debug for SubtableFmt<'a, T> {
68+
impl<T: fmt::Debug> fmt::Debug for SubtableFmt<'_, T> {
6969
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
7070
f.debug_set().entries(self.0.subtable_iter(self.1)).finish()
7171
}
@@ -96,7 +96,7 @@ const ALLOCATOR_SHIFT: u32 = 20;
9696
/// Drop guard to prevent exposing invalid entries on panics.
9797
struct InvalidateChunkOnDrop<'a, T>(&'a mut Chunk<T>);
9898

99-
impl<'a, T> Drop for InvalidateChunkOnDrop<'a, T> {
99+
impl<T> Drop for InvalidateChunkOnDrop<'_, T> {
100100
fn drop(&mut self) {
101101
// This is only called when the drop implementation of an entry panics. In that situation,
102102
// we do the minimum necessary to remain memory safe but spend no effort cleaning up. Since
@@ -111,7 +111,7 @@ impl<'a, T> Drop for InvalidateChunkOnDrop<'a, T> {
111111
}
112112
}
113113

114-
impl<'a, T> InvalidateChunkOnDrop<'a, T> {
114+
impl<T> InvalidateChunkOnDrop<'_, T> {
115115
fn defuse(self) {
116116
let _ = ManuallyDrop::new(self);
117117
}

table_seq/src/table_seq/entry.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,11 @@ impl<T> TableSeq<T> {
9696

9797
match chunk.meta.entry_type(chunk_slot) {
9898
EntryType::Empty => {
99-
return Entry::Vacant(VacantEntry {
99+
Entry::Vacant(VacantEntry {
100100
tables: self,
101101
subtable,
102102
kind: VacantEntryKind::EmptyTable,
103-
});
103+
})
104104
}
105105
EntryType::Single => {
106106
let node = chunk.node(chunk_alloc);

table_seq/src/table_seq/iter.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pub struct SubtableIter<'a, T> {
55
inner: SubtableIterInner<'a, T>,
66
}
77

8-
impl<'a, T> Default for SubtableIter<'a, T> {
8+
impl<T> Default for SubtableIter<'_, T> {
99
fn default() -> Self {
1010
Self {
1111
inner: SubtableIterInner::Small([].as_slice().iter()),
@@ -62,7 +62,7 @@ impl<'a, T> Iterator for SubtableIter<'a, T> {
6262
}
6363
}
6464

65-
impl<'a, T> ExactSizeIterator for SubtableIter<'a, T> {
65+
impl<T> ExactSizeIterator for SubtableIter<'_, T> {
6666
fn len(&self) -> usize {
6767
match &self.inner {
6868
SubtableIterInner::Small(iter) => iter.len(),
@@ -76,7 +76,7 @@ pub struct SubtableIterMut<'a, T> {
7676
inner: SubtableIterMutInner<'a, T>,
7777
}
7878

79-
impl<'a, T> Default for SubtableIterMut<'a, T> {
79+
impl<T> Default for SubtableIterMut<'_, T> {
8080
fn default() -> Self {
8181
Self {
8282
inner: SubtableIterMutInner::Small(Default::default()),
@@ -133,7 +133,7 @@ impl<'a, T> Iterator for SubtableIterMut<'a, T> {
133133
}
134134
}
135135

136-
impl<'a, T> ExactSizeIterator for SubtableIterMut<'a, T> {
136+
impl<T> ExactSizeIterator for SubtableIterMut<'_, T> {
137137
fn len(&self) -> usize {
138138
match &self.inner {
139139
SubtableIterMutInner::Small(iter) => iter.len(),

table_seq/src/table_seq/table.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,12 +263,12 @@ impl<T> SmallSubtable<T> {
263263
}
264264

265265
if self.len() == SMALL_SUBTABLE_CAPACITY {
266-
return SmallSubtableEntry::FullTable(self);
266+
SmallSubtableEntry::FullTable(self)
267267
} else {
268-
return SmallSubtableEntry::Vacant(SmallSubtableVacantEntry {
268+
SmallSubtableEntry::Vacant(SmallSubtableVacantEntry {
269269
table: self,
270270
byte_hash,
271-
});
271+
})
272272
}
273273
}
274274

0 commit comments

Comments
 (0)