diff --git a/src/libstd/rt/io/net/tcp.rs b/src/libstd/rt/io/net/tcp.rs index 27222542e08..746fa5668a5 100644 --- a/src/libstd/rt/io/net/tcp.rs +++ b/src/libstd/rt/io/net/tcp.rs @@ -88,9 +88,7 @@ impl Writer for TcpStream { fn write(&mut self, buf: &[u8]) { match (**self).write(buf) { Ok(_) => (), - Err(ioerr) => { - io_error::cond.raise(ioerr); - } + Err(ioerr) => io_error::cond.raise(ioerr), } } @@ -129,9 +127,7 @@ impl TcpListener { impl Listener for TcpListener { fn accept(&mut self) -> Option { match (**self).accept() { - Ok(s) => { - Some(TcpStream::new(s)) - } + Ok(s) => Some(TcpStream::new(s)), Err(ioerr) => { io_error::cond.raise(ioerr); return None; diff --git a/src/libstd/rt/uv/net.rs b/src/libstd/rt/uv/net.rs index c8b3d41a78d..e8d0296e543 100644 --- a/src/libstd/rt/uv/net.rs +++ b/src/libstd/rt/uv/net.rs @@ -190,9 +190,10 @@ impl StreamWatcher { extern fn close_cb(handle: *uvll::uv_stream_t) { let mut stream_watcher: StreamWatcher = NativeHandle::from_native_handle(handle); - stream_watcher.get_watcher_data().close_cb.take_unwrap()(); + let cb = stream_watcher.get_watcher_data().close_cb.take_unwrap(); stream_watcher.drop_watcher_data(); unsafe { free_handle(handle as *c_void) } + cb(); } } } @@ -411,9 +412,10 @@ impl UdpWatcher { extern fn close_cb(handle: *uvll::uv_udp_t) { let mut udp_watcher: UdpWatcher = NativeHandle::from_native_handle(handle); - udp_watcher.get_watcher_data().close_cb.take_unwrap()(); + let cb = udp_watcher.get_watcher_data().close_cb.take_unwrap(); udp_watcher.drop_watcher_data(); unsafe { free_handle(handle as *c_void) } + cb(); } } }