about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorChristopher Berner <me@cberner.com>2024-11-08 08:09:53 -0800
committerGitHub <noreply@github.com>2024-11-08 08:09:53 -0800
commit5a156a79994bf4722a50adad637bd7d0d747abe3 (patch)
tree6c274f4ce4442567d8a78d081876d8d4c93edf75 /library/std/src
parente0fdaa8624ee062b38372c2987947ff2dc6f7113 (diff)
Update library/std/src/sys/pal/windows/fs.rs
Co-authored-by: Jonas Böttiger <jonasboettiger@icloud.com>
Diffstat (limited to 'library/std/src')
-rw-r--r--library/std/src/sys/pal/windows/fs.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/library/std/src/sys/pal/windows/fs.rs b/library/std/src/sys/pal/windows/fs.rs
index 138ac59c161..7bb0e84c88f 100644
--- a/library/std/src/sys/pal/windows/fs.rs
+++ b/library/std/src/sys/pal/windows/fs.rs
@@ -461,13 +461,11 @@ impl File {
         cvt(unsafe { c::UnlockFile(self.handle.as_raw_handle(), 0, 0, u32::MAX, u32::MAX) })?;
         let result =
             cvt(unsafe { c::UnlockFile(self.handle.as_raw_handle(), 0, 0, u32::MAX, u32::MAX) });
-        if let Err(ref err) = result {
-            if err.raw_os_error() == Some(c::ERROR_NOT_LOCKED as i32) {
-                return Ok(());
-            }
+        match result {
+            Ok(_) => Ok(()),
+            Err(err) if err.raw_os_error() == Some(c::ERROR_NOT_LOCKED as i32) => Ok(()),
+            Err(err) => Err(err),
         }
-        result?;
-        Ok(())
     }
 
     pub fn truncate(&self, size: u64) -> io::Result<()> {