Skip to content

Commit

Permalink
Format and clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
Marwes committed Oct 29, 2019
1 parent beeb02e commit 995163a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 18 deletions.
4 changes: 2 additions & 2 deletions tokio/src/io/io/async_buf_read_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub trait AsyncBufReadExt: AsyncBufRead {
///
/// [`read`]: AsyncReadExt::read
/// [`consume`]: AsyncBufRead::consume
fn fill_buf<'a>(&'a mut self) -> FillBuf<'a, Self>
fn fill_buf(&mut self) -> FillBuf<'_, Self>
where
Self: Unpin,
{
Expand All @@ -47,7 +47,7 @@ pub trait AsyncBufReadExt: AsyncBufRead {
/// [`poll_read`]: AsyncRead::poll_read
/// [`get_buf`]: AsyncBufRead::get_buf
/// [`consume`]: AsyncBufRead::consume
fn read_into_buf<'a>(&'a mut self) -> ReadIntoBuf<'a, Self>
fn read_into_buf(&mut self) -> ReadIntoBuf<'_, Self>
where
Self: Unpin,
{
Expand Down
12 changes: 2 additions & 10 deletions tokio/src/io/io/buf_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,7 @@ impl<R: AsyncRead> AsyncBufRead for BufReader<R> {
fn poll_read_into_buf(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<io::Result<usize>> {
#[project]
let BufReader {
inner,
buf,
cap,
pos: _,
inner, buf, cap, ..
} = self.project();

if *cap < buf.len() {
Expand All @@ -148,12 +145,7 @@ impl<R: AsyncRead> AsyncBufRead for BufReader<R> {
#[project]
fn get_buf(self: Pin<&mut Self>) -> &[u8] {
#[project]
let BufReader {
inner: _,
buf,
cap,
pos,
} = self.project();
let BufReader { buf, cap, pos, .. } = self.project();
&buf[*pos..*cap]
}

Expand Down
4 changes: 2 additions & 2 deletions tokio/src/io/io/fill_buf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub struct FillBuf<'a, R: ?Sized> {
reader: Option<&'a mut R>,
}

pub(crate) fn fill_buf<'a, R>(reader: &'a mut R) -> FillBuf<'a, R>
pub(crate) fn fill_buf<R>(reader: &mut R) -> FillBuf<'_, R>
where
R: AsyncBufRead + ?Sized + Unpin,
{
Expand All @@ -28,7 +28,7 @@ impl<'a, R: AsyncBufRead + ?Sized + Unpin> Future for FillBuf<'a, R> {
match reader.as_mut().poll_read_into_buf(cx) {
Poll::Pending => {
self.reader = Some(reader.get_mut());
return Poll::Pending
return Poll::Pending;
}
Poll::Ready(result) => {
result?;
Expand Down
6 changes: 2 additions & 4 deletions tokio/src/io/io/read_into_buf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@ pub struct ReadIntoBuf<'a, R: ?Sized> {
reader: &'a mut R,
}

pub(crate) fn read_into_buf<'a, R>(reader: &'a mut R) -> ReadIntoBuf<'a, R>
pub(crate) fn read_into_buf<R>(reader: &mut R) -> ReadIntoBuf<'_, R>
where
R: AsyncBufRead + ?Sized + Unpin,
{
ReadIntoBuf {
reader,
}
ReadIntoBuf { reader }
}

impl<R: AsyncBufRead + ?Sized + Unpin> Future for ReadIntoBuf<'_, R> {
Expand Down

0 comments on commit 995163a

Please sign in to comment.