Skip to content

Commit

Permalink
style: run cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Shadow53 committed Aug 19, 2024
1 parent 8e7504a commit e0ea29a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/dirs/win.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@ fn pwstr_len(pwstr: PWSTR) -> usize {
#[allow(unsafe_code)]
pub fn get_known_folder(folder_id: GUID) -> WinResult<PathBuf> {
unsafe {
SHGetKnownFolderPath(&folder_id, KF_FLAG_CREATE, HANDLE(std::ptr::null_mut())).map(|pwstr| {
let slice = std::slice::from_raw_parts(pwstr.0, pwstr_len(pwstr));
PathBuf::from(OsString::from_wide(slice))
})
SHGetKnownFolderPath(&folder_id, KF_FLAG_CREATE, HANDLE(std::ptr::null_mut())).map(
|pwstr| {
let slice = std::slice::from_raw_parts(pwstr.0, pwstr_len(pwstr));
PathBuf::from(OsString::from_wide(slice))
},
)
}
}

Expand Down

0 comments on commit e0ea29a

Please sign in to comment.