mirror of
https://github.com/tokio-rs/bytes.git
synced 2026-08-15 00:00:18 +02:00
Fix latest clippy warnings (#787)
This commit is contained in:
+4
-4
@@ -779,7 +779,7 @@ impl BytesMut {
|
||||
self.ptr = vptr(v.as_mut_ptr());
|
||||
self.cap = v.capacity();
|
||||
debug_assert_eq!(self.len, v.len());
|
||||
return true;
|
||||
true
|
||||
}
|
||||
|
||||
/// Attempts to cheaply reclaim already allocated capacity for at least `additional` more
|
||||
@@ -985,7 +985,7 @@ impl BytesMut {
|
||||
// new start and updating the `len` field to reflect the new length
|
||||
// of the view.
|
||||
self.ptr = vptr(self.ptr.as_ptr().add(count));
|
||||
self.len = self.len.checked_sub(count).unwrap_or(0);
|
||||
self.len = self.len.saturating_sub(count);
|
||||
self.cap -= count;
|
||||
}
|
||||
|
||||
@@ -1283,7 +1283,7 @@ impl PartialEq for BytesMut {
|
||||
|
||||
impl PartialOrd for BytesMut {
|
||||
fn partial_cmp(&self, other: &BytesMut) -> Option<cmp::Ordering> {
|
||||
self.as_slice().partial_cmp(other.as_slice())
|
||||
Some(self.cmp(other))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1718,7 +1718,7 @@ impl From<BytesMut> for Vec<u8> {
|
||||
rebuild_vec(bytes.ptr.as_ptr(), bytes.len, bytes.cap, off)
|
||||
}
|
||||
} else {
|
||||
let shared = bytes.data as *mut Shared;
|
||||
let shared = bytes.data;
|
||||
|
||||
if unsafe { (*shared).is_unique() } {
|
||||
let vec = core::mem::take(unsafe { &mut (*shared).vec });
|
||||
|
||||
Reference in New Issue
Block a user