refactor(lib): replace 'try' macro with '?'
This commit is contained in:
@@ -333,7 +333,7 @@ impl<R: Resolve> Future for HttpConnecting<R> {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
State::Resolving(ref mut future, local_addr) => {
|
State::Resolving(ref mut future, local_addr) => {
|
||||||
match try!(future.poll()) {
|
match future.poll()? {
|
||||||
Async::NotReady => return Ok(Async::NotReady),
|
Async::NotReady => return Ok(Async::NotReady),
|
||||||
Async::Ready(addrs) => {
|
Async::Ready(addrs) => {
|
||||||
let port = self.port;
|
let port = self.port;
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ impl<T: Read> Read for AsyncIo<T> {
|
|||||||
Err(self.would_block())
|
Err(self.would_block())
|
||||||
} else {
|
} else {
|
||||||
let n = cmp::min(self.bytes_until_block, buf.len());
|
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;
|
self.bytes_until_block -= n;
|
||||||
Ok(n)
|
Ok(n)
|
||||||
}
|
}
|
||||||
@@ -234,7 +234,7 @@ impl<T: Write> Write for AsyncIo<T> {
|
|||||||
trace!("AsyncIo::write; {} bytes", data.len());
|
trace!("AsyncIo::write; {} bytes", data.len());
|
||||||
self.flushed = false;
|
self.flushed = false;
|
||||||
let n = cmp::min(self.bytes_until_block, data.len());
|
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;
|
self.bytes_until_block -= n;
|
||||||
Ok(n)
|
Ok(n)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -141,7 +141,10 @@ where
|
|||||||
S: Http1Transaction,
|
S: Http1Transaction,
|
||||||
{
|
{
|
||||||
loop {
|
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) => {
|
Some(msg) => {
|
||||||
debug!("parsed {} headers", msg.head.headers.len());
|
debug!("parsed {} headers", msg.head.headers.len());
|
||||||
return Ok(Async::Ready(msg))
|
return Ok(Async::Ready(msg))
|
||||||
|
|||||||
Reference in New Issue
Block a user