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
This commit is contained in:
parent
0dcc413e42
commit
0f02309e4b
132 changed files with 3755 additions and 3770 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue