Skip to content

Commit

Permalink
refactor(lib): replace 'try' macro with '?'
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmonstar committed Jan 18, 2019
1 parent 6bce753 commit c69d109
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/client/connect/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ impl<R: Resolve> Future for HttpConnecting<R> {
}
},
State::Resolving(ref mut future, local_addr) => {
match try!(future.poll()) {
match future.poll()? {
Async::NotReady => return Ok(Async::NotReady),
Async::Ready(addrs) => {
let port = self.port;
Expand Down
4 changes: 2 additions & 2 deletions src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ impl<T: Read> Read for AsyncIo<T> {
Err(self.would_block())
} else {
let n = cmp::min(self.bytes_until_block, buf.len());
let n = try!(self.inner.read(&mut buf[..n]));
let n = self.inner.read(&mut buf[..n])?;
self.bytes_until_block -= n;
Ok(n)
}
Expand All @@ -234,7 +234,7 @@ impl<T: Write> Write for AsyncIo<T> {
trace!("AsyncIo::write; {} bytes", data.len());
self.flushed = false;
let n = cmp::min(self.bytes_until_block, data.len());
let n = try!(self.inner.write(&data[..n]));
let n = self.inner.write(&data[..n])?;
self.bytes_until_block -= n;
Ok(n)
}
Expand Down
5 changes: 4 additions & 1 deletion src/proto/h1/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,10 @@ where
S: Http1Transaction,
{
loop {
match try!(S::parse(&mut self.read_buf, ParseContext { cached_headers: ctx.cached_headers, req_method: ctx.req_method, })) {
match S::parse(&mut self.read_buf, ParseContext {
cached_headers: ctx.cached_headers,
req_method: ctx.req_method,
})? {
Some(msg) => {
debug!("parsed {} headers", msg.head.headers.len());
return Ok(Async::Ready(msg))
Expand Down

0 comments on commit c69d109

Please sign in to comment.