We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3dec656 commit 4d02380Copy full SHA for 4d02380
1 file changed
src/uu/hostname/src/hostname.rs
@@ -38,10 +38,8 @@ mod wsa {
38
pub(super) struct WsaHandle(());
39
40
pub(super) fn start() -> io::Result<WsaHandle> {
41
- let err = unsafe {
42
- let mut data = std::mem::MaybeUninit::<WSADATA>::uninit();
43
- WSAStartup(0x0202, data.as_mut_ptr())
44
- };
+ let mut data = std::mem::MaybeUninit::<WSADATA>::uninit();
+ let err = unsafe { WSAStartup(0x0202, data.as_mut_ptr()) };
45
if err == 0 {
46
Ok(WsaHandle(()))
47
} else {
@@ -51,10 +49,8 @@ mod wsa {
51
49
52
50
impl Drop for WsaHandle {
53
fn drop(&mut self) {
54
- unsafe {
55
- // This possibly returns an error but we can't handle it
56
- let _err = WSACleanup();
57
- }
+ // This possibly returns an error but we can't handle it
+ let _ = unsafe { WSACleanup() };
58
}
59
60
0 commit comments