@@ -26,7 +26,7 @@ macro_rules! call {
26
26
}
27
27
28
28
#[ cfg( target_os = "windows" ) ]
29
- fn path_to_windows_str < T : AsRef < OsStr > > ( path : T ) -> Vec < u16 > {
29
+ fn path_to_windows_str < T : AsRef < OsStr > > ( path : & T ) -> Vec < u16 > {
30
30
path. as_ref ( ) . encode_wide ( ) . chain ( Some ( 0 ) ) . collect ( )
31
31
}
32
32
@@ -164,8 +164,8 @@ impl KVStore for FilesystemStore {
164
164
let res = if dest_file_path. exists ( ) {
165
165
call ! ( unsafe {
166
166
windows_sys:: Win32 :: Storage :: FileSystem :: ReplaceFileW (
167
- path_to_windows_str( dest_file_path. clone ( ) ) . as_ptr( ) ,
168
- path_to_windows_str( tmp_file_path) . as_ptr( ) ,
167
+ path_to_windows_str( & dest_file_path) . as_ptr( ) ,
168
+ path_to_windows_str( & tmp_file_path) . as_ptr( ) ,
169
169
std:: ptr:: null( ) ,
170
170
windows_sys:: Win32 :: Storage :: FileSystem :: REPLACEFILE_IGNORE_MERGE_ERRORS ,
171
171
std:: ptr:: null_mut( ) as * const core:: ffi:: c_void,
@@ -175,8 +175,8 @@ impl KVStore for FilesystemStore {
175
175
} else {
176
176
call ! ( unsafe {
177
177
windows_sys:: Win32 :: Storage :: FileSystem :: MoveFileExW (
178
- path_to_windows_str( tmp_file_path) . as_ptr( ) ,
179
- path_to_windows_str( dest_file_path. clone ( ) ) . as_ptr( ) ,
178
+ path_to_windows_str( & tmp_file_path) . as_ptr( ) ,
179
+ path_to_windows_str( & dest_file_path) . as_ptr( ) ,
180
180
windows_sys:: Win32 :: Storage :: FileSystem :: MOVEFILE_WRITE_THROUGH
181
181
| windows_sys:: Win32 :: Storage :: FileSystem :: MOVEFILE_REPLACE_EXISTING ,
182
182
)
@@ -263,8 +263,8 @@ impl KVStore for FilesystemStore {
263
263
264
264
call ! ( unsafe {
265
265
windows_sys:: Win32 :: Storage :: FileSystem :: MoveFileExW (
266
- path_to_windows_str( dest_file_path) . as_ptr( ) ,
267
- path_to_windows_str( trash_file_path. clone ( ) ) . as_ptr( ) ,
266
+ path_to_windows_str( & dest_file_path) . as_ptr( ) ,
267
+ path_to_windows_str( & trash_file_path) . as_ptr( ) ,
268
268
windows_sys:: Win32 :: Storage :: FileSystem :: MOVEFILE_WRITE_THROUGH
269
269
| windows_sys:: Win32 :: Storage :: FileSystem :: MOVEFILE_REPLACE_EXISTING ,
270
270
)
0 commit comments