Skip to content

Commit 66ed6b0

Browse files
committed
Use to_vec in Socket::tcp_congestion
1 parent 548edb4 commit 66ed6b0

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/sys/unix.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2708,11 +2708,7 @@ impl crate::Socket {
27082708
payload.as_mut_ptr().cast(),
27092709
&mut len,
27102710
))
2711-
.map(|_| {
2712-
let buf = &payload[..len as usize];
2713-
// TODO: use `MaybeUninit::slice_assume_init_ref` once stable.
2714-
unsafe { &*(buf as *const [u8]) }.into()
2715-
})
2711+
.map(|_| payload[..len as usize].to_vec())
27162712
}
27172713

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

0 commit comments

Comments
 (0)