@@ -351,14 +351,14 @@ impl<'a, T: 'a, const N: usize> DoubleEndedIterator for Drain<'a, T, N> {
351
351
}
352
352
}
353
353
354
- impl < ' a , T , const N : usize > ExactSizeIterator for Drain < ' a , T , N > {
354
+ impl < T , const N : usize > ExactSizeIterator for Drain < ' _ , T , N > {
355
355
#[ inline]
356
356
fn len ( & self ) -> usize {
357
357
self . iter . len ( )
358
358
}
359
359
}
360
360
361
- impl < ' a , T , const N : usize > core:: iter:: FusedIterator for Drain < ' a , T , N > { }
361
+ impl < T , const N : usize > core:: iter:: FusedIterator for Drain < ' _ , T , N > { }
362
362
363
363
impl < ' a , T : ' a , const N : usize > Drop for Drain < ' a , T , N > {
364
364
fn drop ( & mut self ) {
@@ -1335,7 +1335,7 @@ impl<T, const N: usize> SmallVec<T, N> {
1335
1335
if !f ( & mut * ptr. add ( i) ) {
1336
1336
del += 1 ;
1337
1337
} else if del > 0 {
1338
- core:: mem :: swap ( & mut * ptr. add ( i) , & mut * ptr. add ( i - del) ) ;
1338
+ core:: ptr :: swap ( ptr. add ( i) , ptr. add ( i - del) ) ;
1339
1339
}
1340
1340
}
1341
1341
}
@@ -1386,7 +1386,7 @@ impl<T, const N: usize> SmallVec<T, N> {
1386
1386
if !same_bucket ( & mut * p_r, & mut * p_wm1) {
1387
1387
if r != w {
1388
1388
let p_w = p_wm1. add ( 1 ) ;
1389
- core:: mem :: swap ( & mut * p_r, & mut * p_w) ;
1389
+ core:: ptr :: swap ( p_r, p_w) ;
1390
1390
}
1391
1391
w += 1 ;
1392
1392
}
@@ -1449,39 +1449,35 @@ impl<T, const N: usize> SmallVec<T, N> {
1449
1449
/// # Examples
1450
1450
///
1451
1451
/// ```
1452
- /// use std::mem;
1453
- /// use std::ptr;
1454
1452
/// use smallvec::{SmallVec, smallvec};
1455
1453
///
1456
- /// fn main() {
1457
- /// let mut v: SmallVec<_, 1> = smallvec![1, 2, 3];
1454
+ /// let mut v: SmallVec<_, 1> = smallvec![1, 2, 3];
1458
1455
///
1459
- /// // Pull out the important parts of `v`.
1460
- /// let p = v.as_mut_ptr();
1461
- /// let len = v.len();
1462
- /// let cap = v.capacity();
1463
- /// let spilled = v.spilled();
1456
+ /// // Pull out the important parts of `v`.
1457
+ /// let p = v.as_mut_ptr();
1458
+ /// let len = v.len();
1459
+ /// let cap = v.capacity();
1460
+ /// let spilled = v.spilled();
1464
1461
///
1465
- /// unsafe {
1466
- /// // Forget all about `v`. The heap allocation that stored the
1467
- /// // three values won't be deallocated.
1468
- /// mem::forget(v);
1462
+ /// unsafe {
1463
+ /// // Forget all about `v`. The heap allocation that stored the
1464
+ /// // three values won't be deallocated.
1465
+ /// std:: mem::forget(v);
1469
1466
///
1470
- /// // Overwrite memory with [4, 5, 6].
1471
- /// //
1472
- /// // This is only safe if `spilled` is true! Otherwise, we are
1473
- /// // writing into the old `SmallVec`'s inline storage on the
1474
- /// // stack.
1475
- /// assert!(spilled);
1476
- /// for i in 0..len {
1477
- /// ptr::write(p.add(i), 4 + i);
1478
- /// }
1479
- ///
1480
- /// // Put everything back together into a SmallVec with a different
1481
- /// // amount of inline storage, but which is still less than `cap`.
1482
- /// let rebuilt = SmallVec::<_, 2>::from_raw_parts(p, len, cap);
1483
- /// assert_eq!(&*rebuilt, &[4, 5, 6]);
1467
+ /// // Overwrite memory with [4, 5, 6].
1468
+ /// //
1469
+ /// // This is only safe if `spilled` is true! Otherwise, we are
1470
+ /// // writing into the old `SmallVec`'s inline storage on the
1471
+ /// // stack.
1472
+ /// assert!(spilled);
1473
+ /// for i in 0..len {
1474
+ /// std::ptr::write(p.add(i), 4 + i);
1484
1475
/// }
1476
+ ///
1477
+ /// // Put everything back together into a SmallVec with a different
1478
+ /// // amount of inline storage, but which is still less than `cap`.
1479
+ /// let rebuilt = SmallVec::<_, 2>::from_raw_parts(p, len, cap);
1480
+ /// assert_eq!(&*rebuilt, &[4, 5, 6]);
1485
1481
/// }
1486
1482
/// ```
1487
1483
#[ inline]
@@ -2108,7 +2104,7 @@ impl<T: Debug, const N: usize> Debug for IntoIter<T, N> {
2108
2104
}
2109
2105
}
2110
2106
2111
- impl < ' a , T : Debug , const N : usize > Debug for Drain < ' a , T , N > {
2107
+ impl < T : Debug , const N : usize > Debug for Drain < ' _ , T , N > {
2112
2108
fn fmt ( & self , f : & mut core:: fmt:: Formatter < ' _ > ) -> core:: fmt:: Result {
2113
2109
f. debug_tuple ( "Drain" ) . field ( & self . iter . as_slice ( ) ) . finish ( )
2114
2110
}
0 commit comments