diff options
| author | Jorge Aparicio <japaricious@gmail.com> | 2016-03-22 22:01:37 -0500 |
|---|---|---|
| committer | Jorge Aparicio <japaricious@gmail.com> | 2016-03-22 22:01:37 -0500 |
| commit | 0f02309e4b0ea05ee905205278fb6d131341c41f (patch) | |
| tree | a259129eeb84705de15b51587ddebd0f82735075 /src/libstd/sys/unix/net.rs | |
| parent | 0dcc413e42f15f4fc51a0ca88a99cc89454ec43d (diff) | |
| download | rust-0f02309e4b0ea05ee905205278fb6d131341c41f.tar.gz rust-0f02309e4b0ea05ee905205278fb6d131341c41f.zip | |
try! -> ?
Automated conversion using the untry tool [1] and the following command: ``` $ find -name '*.rs' -type f | xargs untry ``` at the root of the Rust repo. [1]: https://github.com/japaric/untry
Diffstat (limited to 'src/libstd/sys/unix/net.rs')
| -rw-r--r-- | src/libstd/sys/unix/net.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/libstd/sys/unix/net.rs b/src/libstd/sys/unix/net.rs index d7b353c9b2a..830957a7e59 100644 --- a/src/libstd/sys/unix/net.rs +++ b/src/libstd/sys/unix/net.rs @@ -75,7 +75,7 @@ impl Socket { } } - let fd = try!(cvt(libc::socket(fam, ty, 0))); + let fd = cvt(libc::socket(fam, ty, 0))?; let fd = FileDesc::new(fd); fd.set_cloexec(); Ok(Socket(fd)) @@ -97,7 +97,7 @@ impl Socket { } } - try!(cvt(libc::socketpair(fam, ty, 0, fds.as_mut_ptr()))); + cvt(libc::socketpair(fam, ty, 0, fds.as_mut_ptr()))?; let a = FileDesc::new(fds[0]); a.set_cloexec(); let b = FileDesc::new(fds[1]); @@ -128,9 +128,9 @@ impl Socket { } } - let fd = try!(cvt_r(|| unsafe { + let fd = cvt_r(|| unsafe { libc::accept(self.0.raw(), storage, len) - })); + })?; let fd = FileDesc::new(fd); fd.set_cloexec(); Ok(Socket(fd)) @@ -185,7 +185,7 @@ impl Socket { } pub fn timeout(&self, kind: libc::c_int) -> io::Result<Option<Duration>> { - let raw: libc::timeval = try!(getsockopt(self, libc::SOL_SOCKET, kind)); + let raw: libc::timeval = getsockopt(self, libc::SOL_SOCKET, kind)?; if raw.tv_sec == 0 && raw.tv_usec == 0 { Ok(None) } else { @@ -201,7 +201,7 @@ impl Socket { Shutdown::Read => libc::SHUT_RD, Shutdown::Both => libc::SHUT_RDWR, }; - try!(cvt(unsafe { libc::shutdown(self.0.raw(), how) })); + cvt(unsafe { libc::shutdown(self.0.raw(), how) })?; Ok(()) } @@ -210,7 +210,7 @@ impl Socket { } pub fn nodelay(&self) -> io::Result<bool> { - let raw: c_int = try!(getsockopt(self, libc::IPPROTO_TCP, libc::TCP_NODELAY)); + let raw: c_int = getsockopt(self, libc::IPPROTO_TCP, libc::TCP_NODELAY)?; Ok(raw != 0) } @@ -220,7 +220,7 @@ impl Socket { } pub fn take_error(&self) -> io::Result<Option<io::Error>> { - let raw: c_int = try!(getsockopt(self, libc::SOL_SOCKET, libc::SO_ERROR)); + let raw: c_int = getsockopt(self, libc::SOL_SOCKET, libc::SO_ERROR)?; if raw == 0 { Ok(None) } else { |
