diff --git a/Cargo.toml b/Cargo.toml index f21b11a..e1f94b9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,7 +41,7 @@ native-tls = { version = "0.2.12", optional = true } [target.'cfg(windows)'.dependencies.windows-sys] version = "0.59" -features = ["Win32_Foundation", "Win32_Storage_FileSystem"] +features = ["Win32_Foundation", "Win32_Storage_FileSystem", "Win32_System_IO"] optional = true [target.'cfg(unix)'.dependencies.libc] diff --git a/src/api/sync.rs b/src/api/sync.rs index b047bf0..3bc8bfc 100644 --- a/src/api/sync.rs +++ b/src/api/sync.rs @@ -122,7 +122,7 @@ mod windows { pub(crate) fn lock(file: &std::fs::File) -> i32 { unsafe { - let mut overlapped = mem::zeroed(); + let mut overlapped = std::mem::zeroed(); let flags = LOCKFILE_EXCLUSIVE_LOCK | LOCKFILE_FAIL_IMMEDIATELY; LockFileEx( file.as_raw_handle() as HANDLE, @@ -135,9 +135,7 @@ mod windows { } } pub(crate) fn unlock(file: &std::fs::File) -> i32 { - unsafe { - UnlockFile(file.as_raw_handle() as HANDLE, 0, 0, !0, !0); - } + unsafe { UnlockFile(file.as_raw_handle() as HANDLE, 0, 0, !0, !0) } } } #[cfg(target_family = "windows")] diff --git a/src/api/tokio.rs b/src/api/tokio.rs index 4311823..698ece7 100644 --- a/src/api/tokio.rs +++ b/src/api/tokio.rs @@ -116,7 +116,7 @@ mod windows { pub(crate) fn lock(file: &tokio::fs::File) -> i32 { unsafe { - let mut overlapped = mem::zeroed(); + let mut overlapped = std::mem::zeroed(); let flags = LOCKFILE_EXCLUSIVE_LOCK | LOCKFILE_FAIL_IMMEDIATELY; LockFileEx( file.as_raw_handle() as HANDLE, @@ -129,9 +129,7 @@ mod windows { } } pub(crate) fn unlock(file: &tokio::fs::File) -> i32 { - unsafe { - UnlockFile(file.as_raw_handle() as HANDLE, 0, 0, !0, !0); - } + unsafe { UnlockFile(file.as_raw_handle() as HANDLE, 0, 0, !0, !0) } } } #[cfg(target_family = "windows")]