Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ impl PartialEq for Bytes {

impl PartialOrd for Bytes {
fn partial_cmp(&self, other: &Bytes) -> Option<cmp::Ordering> {
self.as_slice().partial_cmp(other.as_slice())
Some(self.cmp(other))
}
}

Expand Down Expand Up @@ -1536,7 +1536,7 @@ unsafe fn shallow_clone_vec(
// pointed to by `actual` will be visible.
match atom.compare_exchange(ptr as _, shared as _, Ordering::AcqRel, Ordering::Acquire) {
Ok(actual) => {
debug_assert!(actual as usize == ptr as usize);
debug_assert!(core::ptr::eq(actual, ptr));
// The upgrade was successful, the new handle can be
// returned.
Bytes {
Expand Down
8 changes: 4 additions & 4 deletions src/bytes_mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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))
}
}

Expand Down Expand Up @@ -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 });
Expand Down
2 changes: 1 addition & 1 deletion tests/test_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ fn vectored_read() {

#[test]
fn chain_growing_buffer() {
let mut buff = [' ' as u8; 10];
let mut buff = [b' '; 10];
let mut vec = b"wassup".to_vec();

let mut chained = (&mut buff[..]).chain_mut(&mut vec).chain_mut(Vec::new()); // Required for potential overflow because remaining_mut for Vec is isize::MAX - vec.len(), but for chain_mut is usize::MAX
Expand Down
Loading