Fix latest clippy warnings (#787)

This commit is contained in:
Paolo Barbolini
2025-07-16 10:53:50 +02:00
committed by GitHub
parent 3e44f88f5f
commit 16132ad259
3 changed files with 7 additions and 7 deletions
+4 -4
View File
@@ -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 });