Skip to content

Commit 5e1993b

Browse files
committed
get rid of warnings (also fixes msvc build)
Signed-off-by: Kirill Mironov <[email protected]>
1 parent bcf1161 commit 5e1993b

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

src/io/buf_writer.rs

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
use crate::io::Write;
21
use crate::task::{Context, Poll};
3-
use futures::{ready, AsyncWrite, Future, Stream};
2+
use futures::{ready, AsyncWrite};
43
use std::fmt;
5-
use std::io::{self, IntoInnerError};
4+
use std::io;
65
use std::pin::Pin;
76

87
const DEFAULT_CAPACITY: usize = 8 * 1024;
@@ -74,10 +73,10 @@ const DEFAULT_CAPACITY: usize = 8 * 1024;
7473
/// together by the buffer, and will all be written out in one system call when
7574
/// the `stream` is dropped.
7675
///
77-
/// [`Write`]: ../../std/io/trait.Write.html
78-
/// [`TcpStream::write`]: ../../std/net/struct.TcpStream.html#method.write
79-
/// [`TcpStream`]: ../../std/net/struct.TcpStream.html
80-
/// [`flush`]: #method.flush
76+
/// [`Write`]: trait.Write.html
77+
/// [`TcpStream::write`]: ../net/struct.TcpStream.html#method.write
78+
/// [`TcpStream`]: ../net/struct.TcpStream.html
79+
/// [`flush`]: trait.Write.html#tymethod.flush
8180
pub struct BufWriter<W> {
8281
inner: W,
8382
buf: Vec<u8>,
@@ -218,6 +217,7 @@ impl<W: AsyncWrite + Unpin> BufWriter<W> {
218217
&self.buf
219218
}
220219

220+
221221
pub fn poll_flush_buf(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<io::Result<()>> {
222222
let Self {
223223
inner,
@@ -256,7 +256,7 @@ impl<W: AsyncWrite + Unpin> BufWriter<W> {
256256
impl<W: AsyncWrite + Unpin> AsyncWrite for BufWriter<W> {
257257
fn poll_write(
258258
mut self: Pin<&mut Self>,
259-
cx: &mut Context,
259+
cx: &mut Context<'_>,
260260
buf: &[u8],
261261
) -> Poll<io::Result<usize>> {
262262
if self.buf.len() + buf.len() > self.buf.capacity() {
@@ -269,12 +269,12 @@ impl<W: AsyncWrite + Unpin> AsyncWrite for BufWriter<W> {
269269
}
270270
}
271271

272-
fn poll_flush(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll<io::Result<()>> {
272+
fn poll_flush(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<io::Result<()>> {
273273
ready!(self.as_mut().poll_flush_buf(cx))?;
274274
self.inner().poll_flush(cx)
275275
}
276276

277-
fn poll_close(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll<io::Result<()>> {
277+
fn poll_close(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<io::Result<()>> {
278278
ready!(self.as_mut().poll_flush_buf(cx))?;
279279
self.inner().poll_close(cx)
280280
}
@@ -356,7 +356,7 @@ impl<W: AsyncWrite + Unpin> LineWriter<W> {
356356
impl<W: AsyncWrite + Unpin> AsyncWrite for LineWriter<W> {
357357
fn poll_write(
358358
mut self: Pin<&mut Self>,
359-
cx: &mut Context,
359+
cx: &mut Context<'_>,
360360
buf: &[u8],
361361
) -> Poll<io::Result<usize>> {
362362
if self.need_flush {
@@ -379,13 +379,13 @@ impl<W: AsyncWrite + Unpin> AsyncWrite for LineWriter<W> {
379379
}
380380
}
381381

382-
fn poll_flush(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll<io::Result<()>> {
382+
fn poll_flush(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<io::Result<()>> {
383383
self.as_mut().inner().poll_flush(cx)?;
384384
*self.need_flush() = false;
385385
Poll::Ready(Ok(()))
386386
}
387387

388-
fn poll_close(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll<io::Result<()>> {
388+
fn poll_close(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<io::Result<()>> {
389389
self.as_mut().inner().poll_flush(cx)?;
390390
self.inner().poll_close(cx)
391391
}
@@ -407,6 +407,7 @@ where
407407
}
408408

409409
mod tests {
410+
#![allow(unused_imports)]
410411
use super::LineWriter;
411412
use crate::prelude::*;
412413
use crate::task;

0 commit comments

Comments
 (0)