diff --git a/src/libstd/sys/windows/mod.rs b/src/libstd/sys/windows/mod.rs index a13c03c7448c..3acb372f658c 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() {