diff options
author | Carl Lerche <me@carllerche.com> | 2019-02-21 11:56:15 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-21 11:56:15 -0800 |
commit | 80162306e71c8561873a9c9496d65f2c1387d119 (patch) | |
tree | 83327ca8d9d1326d54e3c679e1fb4eb16775d4be /tokio-io/src/async_write.rs | |
parent | ab595d08253dd7ee0422144f8dafffa382700976 (diff) |
chore: apply rustfmt to all crates (#917)
Diffstat (limited to 'tokio-io/src/async_write.rs')
-rw-r--r-- | tokio-io/src/async_write.rs | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/tokio-io/src/async_write.rs b/tokio-io/src/async_write.rs index 6fcf418a..0a09480e 100644 --- a/tokio-io/src/async_write.rs +++ b/tokio-io/src/async_write.rs @@ -1,6 +1,6 @@ -use std::io as std_io; use bytes::Buf; use futures::{Async, Poll}; +use std::io as std_io; use AsyncRead; @@ -46,9 +46,7 @@ pub trait AsyncWrite: std_io::Write { fn poll_write(&mut self, buf: &[u8]) -> Poll<usize, std_io::Error> { match self.write(buf) { Ok(t) => Ok(Async::Ready(t)), - Err(ref e) if e.kind() == std_io::ErrorKind::WouldBlock => { - return Ok(Async::NotReady) - } + Err(ref e) if e.kind() == std_io::ErrorKind::WouldBlock => return Ok(Async::NotReady), Err(e) => return Err(e.into()), } } @@ -65,9 +63,7 @@ pub trait AsyncWrite: std_io::Write { fn poll_flush(&mut self) -> Poll<(), std_io::Error> { match self.flush() { Ok(t) => Ok(Async::Ready(t)), - Err(ref e) if e.kind() == std_io::ErrorKind::WouldBlock => { - return Ok(Async::NotReady) - } + Err(ref e) if e.kind() == std_io::ErrorKind::WouldBlock => return Ok(Async::NotReady), Err(e) => return Err(e.into()), } } @@ -137,7 +133,8 @@ pub trait AsyncWrite: std_io::Write { /// Note that this method will advance the `buf` provided automatically by /// the number of bytes written. fn write_buf<B: Buf>(&mut self, buf: &mut B) -> Poll<usize, std_io::Error> - where Self: Sized, + where + Self: Sized, { if !buf.has_remaining() { return Ok(Async::Ready(0)); @@ -179,8 +176,9 @@ impl<T: AsyncRead> AsyncRead for std_io::Take<T> { } impl<T, U> AsyncRead for std_io::Chain<T, U> - where T: AsyncRead, - U: AsyncRead, +where + T: AsyncRead, + U: AsyncRead, { unsafe fn prepare_uninitialized_buffer(&self, buf: &mut [u8]) -> bool { let (t, u) = self.get_ref(); @@ -203,8 +201,7 @@ impl<T: AsyncRead> AsyncRead for std_io::BufReader<T> { } } -impl<T: AsRef<[u8]>> AsyncRead for std_io::Cursor<T> { -} +impl<T: AsRef<[u8]>> AsyncRead for std_io::Cursor<T> {} impl<'a> AsyncWrite for std_io::Cursor<&'a mut [u8]> { fn shutdown(&mut self) -> Poll<(), std_io::Error> { |