@@ -603,7 +603,7 @@ impl BytesMut {
603
603
v. reserve ( additional) ;
604
604
605
605
// Update the info
606
- self . ptr = vptr ( v. as_mut_ptr ( ) . offset ( off as isize ) ) ;
606
+ self . ptr = vptr ( v. as_mut_ptr ( ) . add ( off) ) ;
607
607
self . len = v. len ( ) - off;
608
608
self . cap = v. capacity ( ) - off;
609
609
}
@@ -818,7 +818,7 @@ impl BytesMut {
818
818
// Updating the start of the view is setting `ptr` to point to the
819
819
// new start and updating the `len` field to reflect the new length
820
820
// of the view.
821
- self . ptr = vptr ( self . ptr . as_ptr ( ) . offset ( start as isize ) ) ;
821
+ self . ptr = vptr ( self . ptr . as_ptr ( ) . add ( start) ) ;
822
822
823
823
if self . len >= start {
824
824
self . len -= start;
@@ -842,7 +842,7 @@ impl BytesMut {
842
842
return Ok ( ( ) ) ;
843
843
}
844
844
845
- let ptr = unsafe { self . ptr . as_ptr ( ) . offset ( self . len as isize ) } ;
845
+ let ptr = unsafe { self . ptr . as_ptr ( ) . add ( self . len ) } ;
846
846
if ptr == other. ptr . as_ptr ( )
847
847
&& self . kind ( ) == KIND_ARC
848
848
&& other. kind ( ) == KIND_ARC
@@ -931,7 +931,7 @@ impl BytesMut {
931
931
#[ inline]
932
932
fn uninit_slice ( & mut self ) -> & mut UninitSlice {
933
933
unsafe {
934
- let ptr = self . ptr . as_ptr ( ) . offset ( self . len as isize ) ;
934
+ let ptr = self . ptr . as_ptr ( ) . add ( self . len ) ;
935
935
let len = self . cap - self . len ;
936
936
937
937
UninitSlice :: from_raw_parts_mut ( ptr, len)
@@ -1178,7 +1178,7 @@ impl<'a> IntoIterator for &'a BytesMut {
1178
1178
type IntoIter = core:: slice:: Iter < ' a , u8 > ;
1179
1179
1180
1180
fn into_iter ( self ) -> Self :: IntoIter {
1181
- self . as_ref ( ) . into_iter ( )
1181
+ self . as_ref ( ) . iter ( )
1182
1182
}
1183
1183
}
1184
1184
@@ -1207,7 +1207,7 @@ impl<'a> Extend<&'a u8> for BytesMut {
1207
1207
where
1208
1208
T : IntoIterator < Item = & ' a u8 > ,
1209
1209
{
1210
- self . extend ( iter. into_iter ( ) . map ( |b| * b ) )
1210
+ self . extend ( iter. into_iter ( ) . copied ( ) )
1211
1211
}
1212
1212
}
1213
1213
@@ -1219,7 +1219,7 @@ impl FromIterator<u8> for BytesMut {
1219
1219
1220
1220
impl < ' a > FromIterator < & ' a u8 > for BytesMut {
1221
1221
fn from_iter < T : IntoIterator < Item = & ' a u8 > > ( into_iter : T ) -> Self {
1222
- BytesMut :: from_iter ( into_iter. into_iter ( ) . map ( |b| * b ) )
1222
+ BytesMut :: from_iter ( into_iter. into_iter ( ) . copied ( ) )
1223
1223
}
1224
1224
}
1225
1225
@@ -1409,7 +1409,7 @@ impl PartialOrd<BytesMut> for str {
1409
1409
1410
1410
impl PartialEq < Vec < u8 > > for BytesMut {
1411
1411
fn eq ( & self , other : & Vec < u8 > ) -> bool {
1412
- * self == & other[ ..]
1412
+ * self == other[ ..]
1413
1413
}
1414
1414
}
1415
1415
@@ -1433,7 +1433,7 @@ impl PartialOrd<BytesMut> for Vec<u8> {
1433
1433
1434
1434
impl PartialEq < String > for BytesMut {
1435
1435
fn eq ( & self , other : & String ) -> bool {
1436
- * self == & other[ ..]
1436
+ * self == other[ ..]
1437
1437
}
1438
1438
}
1439
1439
@@ -1499,13 +1499,13 @@ impl PartialOrd<BytesMut> for &str {
1499
1499
1500
1500
impl PartialEq < BytesMut > for Bytes {
1501
1501
fn eq ( & self , other : & BytesMut ) -> bool {
1502
- & other[ ..] == & self [ ..]
1502
+ other[ ..] == self [ ..]
1503
1503
}
1504
1504
}
1505
1505
1506
1506
impl PartialEq < Bytes > for BytesMut {
1507
1507
fn eq ( & self , other : & Bytes ) -> bool {
1508
- & other[ ..] == & self [ ..]
1508
+ other[ ..] == self [ ..]
1509
1509
}
1510
1510
}
1511
1511
0 commit comments