Skip to content
Merged
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
12 changes: 4 additions & 8 deletions src/uu/hostname/src/hostname.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,8 @@ mod wsa {
pub(super) struct WsaHandle(());

pub(super) fn start() -> io::Result<WsaHandle> {
let err = unsafe {
let mut data = std::mem::MaybeUninit::<WSADATA>::uninit();
WSAStartup(0x0202, data.as_mut_ptr())
};
let mut data = std::mem::MaybeUninit::<WSADATA>::uninit();
let err = unsafe { WSAStartup(0x0202, data.as_mut_ptr()) };
if err == 0 {
Ok(WsaHandle(()))
} else {
Expand All @@ -51,10 +49,8 @@ mod wsa {

impl Drop for WsaHandle {
fn drop(&mut self) {
unsafe {
// This possibly returns an error but we can't handle it
let _err = WSACleanup();
}
// This possibly returns an error but we can't handle it
let _ = unsafe { WSACleanup() };
}
}
}
Expand Down
Loading