about summary refs log tree commit diff
path: root/src/libstd/sys/windows
diff options
context:
space:
mode:
authorTobias Bucher <tobiasbucher5991@gmail.com>2015-02-24 17:07:13 +0100
committerTobias Bucher <tobiasbucher5991@gmail.com>2015-02-24 18:03:01 +0100
commit0fc1a7da93e5d431f5cd54a3f1263e2a5f9e5748 (patch)
treedf75970cc1c29a1664272fc3990c6dad5c7a0c4b /src/libstd/sys/windows
parentd0c589d5ced5006f72d766af2ccecf699ff76176 (diff)
downloadrust-0fc1a7da93e5d431f5cd54a3f1263e2a5f9e5748.tar.gz
rust-0fc1a7da93e5d431f5cd54a3f1263e2a5f9e5748.zip
Improve readability of an error check in `set_non_blocking`
Diffstat (limited to 'src/libstd/sys/windows')
-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() {