File tree 1 file changed +12
-11
lines changed
1 file changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -143,7 +143,7 @@ impl Handle {
143
143
) -> io:: Result < Option < usize > > {
144
144
// SAFETY: We have exclusive access to the buffer and it's up to the caller to
145
145
// ensure the OVERLAPPED pointer is valid for the lifetime of this function.
146
- unsafe {
146
+ let ( res , amt ) = unsafe {
147
147
let len = cmp:: min ( buf. len ( ) , u32:: MAX as usize ) as u32 ;
148
148
let mut amt = 0 ;
149
149
let res = cvt ( c:: ReadFile (
@@ -153,16 +153,17 @@ impl Handle {
153
153
& mut amt,
154
154
overlapped,
155
155
) ) ;
156
- match res {
157
- Ok ( _) => Ok ( Some ( amt as usize ) ) ,
158
- Err ( e) => {
159
- if e. raw_os_error ( ) == Some ( c:: ERROR_IO_PENDING as i32 ) {
160
- Ok ( None )
161
- } else if e. raw_os_error ( ) == Some ( c:: ERROR_BROKEN_PIPE as i32 ) {
162
- Ok ( Some ( 0 ) )
163
- } else {
164
- Err ( e)
165
- }
156
+ ( res, amt)
157
+ } ;
158
+ match res {
159
+ Ok ( _) => Ok ( Some ( amt as usize ) ) ,
160
+ Err ( e) => {
161
+ if e. raw_os_error ( ) == Some ( c:: ERROR_IO_PENDING as i32 ) {
162
+ Ok ( None )
163
+ } else if e. raw_os_error ( ) == Some ( c:: ERROR_BROKEN_PIPE as i32 ) {
164
+ Ok ( Some ( 0 ) )
165
+ } else {
166
+ Err ( e)
166
167
}
167
168
}
168
169
}
You can’t perform that action at this time.
0 commit comments