Skip to content

Commit ac66068

Browse files
cbernerjoboet
andauthored
Update library/std/src/sys/pal/windows/fs.rs
Co-authored-by: Jonas Böttiger <[email protected]>
1 parent f1c9904 commit ac66068

File tree

1 file changed

+4
-6
lines changed
  • std/src/sys/pal/windows

1 file changed

+4
-6
lines changed

std/src/sys/pal/windows/fs.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -461,13 +461,11 @@ impl File {
461461
cvt(unsafe { c::UnlockFile(self.handle.as_raw_handle(), 0, 0, u32::MAX, u32::MAX) })?;
462462
let result =
463463
cvt(unsafe { c::UnlockFile(self.handle.as_raw_handle(), 0, 0, u32::MAX, u32::MAX) });
464-
if let Err(ref err) = result {
465-
if err.raw_os_error() == Some(c::ERROR_NOT_LOCKED as i32) {
466-
return Ok(());
467-
}
464+
match result {
465+
Ok(_) => Ok(()),
466+
Err(err) if err.raw_os_error() == Some(c::ERROR_NOT_LOCKED as i32) => Ok(()),
467+
Err(err) => Err(err),
468468
}
469-
result?;
470-
Ok(())
471469
}
472470

473471
pub fn truncate(&self, size: u64) -> io::Result<()> {

0 commit comments

Comments
 (0)