Skip to content

Commit

Permalink
Fix usage of spare_capacity_mut which isn't available in MSRV 1.59 (#190
Browse files Browse the repository at this point in the history
)
  • Loading branch information
prokopyl authored May 22, 2024
1 parent 45465c5 commit 579130e
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/win/drop_target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,9 @@ impl DropTarget {
for i in 0..item_count {
let characters = DragQueryFileW(hdrop, i, null_mut(), 0);
let buffer_size = characters as usize + 1;
let mut buffer = Vec::<u16>::with_capacity(buffer_size);

DragQueryFileW(
hdrop,
i,
buffer.spare_capacity_mut().as_mut_ptr().cast(),
buffer_size as u32,
);
buffer.set_len(buffer_size);
let mut buffer = vec![0u16; buffer_size];

DragQueryFileW(hdrop, i, buffer.as_mut_ptr().cast(), buffer_size as u32);

paths.push(OsString::from_wide(&buffer[..characters as usize]).into())
}
Expand Down

0 comments on commit 579130e

Please sign in to comment.