@@ -44,7 +44,7 @@ mod mmap {
4444 } ;
4545 #[ cfg( windows) ]
4646 use windows_sys:: Win32 :: Storage :: FileSystem :: {
47- GetFileSize , SetEndOfFile , SetFilePointerEx , FILE_BEGIN ,
47+ FILE_BEGIN , GetFileSize , SetEndOfFile , SetFilePointerEx ,
4848 } ;
4949 #[ cfg( windows) ]
5050 use windows_sys:: Win32 :: System :: Threading :: GetCurrentProcess ;
@@ -489,9 +489,7 @@ mod mmap {
489489 let handle = unsafe { suppress_iph ! ( libc:: get_osfhandle( fileno) ) } ;
490490 // Check for invalid handle value (-1 on Windows)
491491 if handle == -1 || handle == INVALID_HANDLE_VALUE as isize {
492- return Err (
493- vm. new_os_error ( format ! ( "Invalid file descriptor: {}" , fileno) )
494- ) ;
492+ return Err ( vm. new_os_error ( format ! ( "Invalid file descriptor: {}" , fileno) ) ) ;
495493 }
496494 Some ( handle as HANDLE )
497495 } else {
@@ -1110,7 +1108,12 @@ mod mmap {
11101108 // Restore original mmap on error
11111109 let err = io:: Error :: last_os_error ( ) ;
11121110 let old_size = self . size . load ( ) ;
1113- if let Ok ( mmap) = Self :: create_mmap_windows ( handle as HANDLE , self . offset , old_size, & self . access ) {
1111+ if let Ok ( mmap) = Self :: create_mmap_windows (
1112+ handle as HANDLE ,
1113+ self . offset ,
1114+ old_size,
1115+ & self . access ,
1116+ ) {
11141117 * mmap_guard = Some ( mmap) ;
11151118 }
11161119 return Err ( err. to_pyexception ( vm) ) ;
@@ -1120,15 +1123,21 @@ mod mmap {
11201123 if result == 0 {
11211124 let err = io:: Error :: last_os_error ( ) ;
11221125 let old_size = self . size . load ( ) ;
1123- if let Ok ( mmap) = Self :: create_mmap_windows ( handle as HANDLE , self . offset , old_size, & self . access ) {
1126+ if let Ok ( mmap) = Self :: create_mmap_windows (
1127+ handle as HANDLE ,
1128+ self . offset ,
1129+ old_size,
1130+ & self . access ,
1131+ ) {
11241132 * mmap_guard = Some ( mmap) ;
11251133 }
11261134 return Err ( err. to_pyexception ( vm) ) ;
11271135 }
11281136
11291137 // Create new mmap with the new size
1130- let new_mmap = Self :: create_mmap_windows ( handle as HANDLE , self . offset , newsize, & self . access )
1131- . map_err ( |e| e. to_pyexception ( vm) ) ?;
1138+ let new_mmap =
1139+ Self :: create_mmap_windows ( handle as HANDLE , self . offset , newsize, & self . access )
1140+ . map_err ( |e| e. to_pyexception ( vm) ) ?;
11321141
11331142 * mmap_guard = Some ( new_mmap) ;
11341143 self . size . store ( newsize) ;
0 commit comments