Skip to content

Commit

Permalink
Use to_vec in Socket::tcp_congestion
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomasdezeeuw committed Aug 29, 2023
1 parent 548edb4 commit 66ed6b0
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/sys/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2708,11 +2708,7 @@ impl crate::Socket {
payload.as_mut_ptr().cast(),
&mut len,
))
.map(|_| {
let buf = &payload[..len as usize];
// TODO: use `MaybeUninit::slice_assume_init_ref` once stable.
unsafe { &*(buf as *const [u8]) }.into()
})
.map(|_| payload[..len as usize].to_vec())
}

/// Set the value of the `TCP_CONGESTION` option for this socket.
Expand Down

0 comments on commit 66ed6b0

Please sign in to comment.