Skip to content

Commit c10da48

Browse files
authored
chore: clippy fixes for win-api-wrappers (#1355)
This fixes a few but not all Clippy lints.
1 parent 4adcf09 commit c10da48

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

crates/win-api-wrappers/src/identity/account.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,10 @@ pub fn lookup_account_by_name(account_name: &U16CStr) -> windows::core::Result<A
347347
pub fn enumerate_account_rights(sid: &Sid) -> anyhow::Result<Vec<U16CString>> {
348348
// Open the local security policy (LSA Policy)
349349

350-
let mut object_attrs = Identity::LSA_OBJECT_ATTRIBUTES::default();
351-
object_attrs.Length = u32size_of::<Identity::LSA_OBJECT_ATTRIBUTES>();
350+
let object_attrs = Identity::LSA_OBJECT_ATTRIBUTES {
351+
Length: u32size_of::<Identity::LSA_OBJECT_ATTRIBUTES>(),
352+
..Default::default()
353+
};
352354

353355
let mut policy_handle = ScopeGuard::new(Identity::LSA_HANDLE::default(), |handle| {
354356
// FIXME: maybe we should log the error here.

crates/win-api-wrappers/src/utils.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ pub fn expand_environment_path(src: &Path, environment: &HashMap<String, String>
457457
))?)
458458
}
459459

460-
use windows::Win32::Foundation::{BOOL, HMODULE};
460+
use windows::Win32::Foundation::HMODULE;
461461
use windows::Win32::Storage::FileSystem::{
462462
GetFileVersionInfoSizeW, GetFileVersionInfoW, VerQueryValueW, VS_FIXEDFILEINFO,
463463
};
@@ -514,9 +514,9 @@ pub fn get_exe_version() -> Result<String, anyhow::Error> {
514514
}
515515

516516
let major = (info.dwFileVersionMS >> 16) & 0xffff;
517-
let minor = (info.dwFileVersionMS >> 0) & 0xffff;
517+
let minor = info.dwFileVersionMS & 0xffff;
518518
let build = (info.dwFileVersionLS >> 16) & 0xffff;
519-
let revision = (info.dwFileVersionLS >> 0) & 0xffff;
519+
let revision = info.dwFileVersionLS & 0xffff;
520520

521521
Ok(format!("{}.{}.{}.{}", major, minor, build, revision))
522522
}

0 commit comments

Comments
 (0)