about summary refs log tree commit diff
path: root/src/libstd/sys
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstd/sys')
-rw-r--r--src/libstd/sys/windows/mod.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libstd/sys/windows/mod.rs b/src/libstd/sys/windows/mod.rs
index a13c03c7448..3acb372f658 100644
--- a/src/libstd/sys/windows/mod.rs
+++ b/src/libstd/sys/windows/mod.rs
@@ -194,11 +194,11 @@ pub fn wouldblock() -> bool {
 
 pub fn set_nonblocking(fd: sock_t, nb: bool) {
     let mut set = nb as libc::c_ulong;
-    (if unsafe { c::ioctlsocket(fd, c::FIONBIO, &mut set) } != 0 {
-        Err(last_error())
-    } else {
-        Ok(())
-    }).unwrap();
+    if unsafe { c::ioctlsocket(fd, c::FIONBIO, &mut set) } != 0 {
+        // The above function should not return an error unless we passed it
+        // invalid parameters. Panic on errors.
+        Err(last_error()).unwrap();
+    }
 }
 
 pub fn init_net() {