diff options
Diffstat (limited to 'tokio-buf/src')
-rw-r--r-- | tokio-buf/src/lib.rs | 17 | ||||
-rw-r--r-- | tokio-buf/src/never.rs | 4 | ||||
-rw-r--r-- | tokio-buf/src/str.rs | 6 | ||||
-rw-r--r-- | tokio-buf/src/u8.rs | 4 | ||||
-rw-r--r-- | tokio-buf/src/util/chain.rs | 4 | ||||
-rw-r--r-- | tokio-buf/src/util/collect.rs | 4 | ||||
-rw-r--r-- | tokio-buf/src/util/from.rs | 6 | ||||
-rw-r--r-- | tokio-buf/src/util/iter.rs | 4 | ||||
-rw-r--r-- | tokio-buf/src/util/limit.rs | 2 | ||||
-rw-r--r-- | tokio-buf/src/util/mod.rs | 2 | ||||
-rw-r--r-- | tokio-buf/src/util/stream.rs | 2 |
11 files changed, 27 insertions, 28 deletions
diff --git a/tokio-buf/src/lib.rs b/tokio-buf/src/lib.rs index c07e4025..823bad49 100644 --- a/tokio-buf/src/lib.rs +++ b/tokio-buf/src/lib.rs @@ -1,6 +1,12 @@ #![doc(html_root_url = "https://docs.rs/tokio-buf/0.1.1")] -#![deny(missing_docs, missing_debug_implementations, unreachable_pub)] +#![deny( + missing_docs, + missing_debug_implementations, + unreachable_pub, + rust_2018_idioms +)] #![cfg_attr(test, deny(warnings))] +#![doc(test(no_crate_inject, attr(deny(rust_2018_idioms))))] //! Asynchronous stream of bytes. //! @@ -9,13 +15,6 @@ //! instead of yielding arbitrary values, it only yields types that implement //! `Buf` (i.e, byte collections). -extern crate bytes; -#[cfg(feature = "util")] -extern crate either; -#[allow(unused)] -#[macro_use] -extern crate futures; - mod never; mod size_hint; mod str; @@ -26,7 +25,7 @@ pub mod util; pub use self::size_hint::SizeHint; #[doc(inline)] #[cfg(feature = "util")] -pub use util::BufStreamExt; +pub use crate::util::BufStreamExt; use bytes::Buf; use futures::Poll; diff --git a/tokio-buf/src/never.rs b/tokio-buf/src/never.rs index dcbde39c..e972167b 100644 --- a/tokio-buf/src/never.rs +++ b/tokio-buf/src/never.rs @@ -4,13 +4,13 @@ use std::{error, fmt}; pub enum Never {} impl fmt::Debug for Never { - fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result { match *self {} } } impl fmt::Display for Never { - fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result { match *self {} } } diff --git a/tokio-buf/src/str.rs b/tokio-buf/src/str.rs index 8af76950..05327be8 100644 --- a/tokio-buf/src/str.rs +++ b/tokio-buf/src/str.rs @@ -1,6 +1,6 @@ -use never::Never; -use BufStream; -use SizeHint; +use crate::never::Never; +use crate::BufStream; +use crate::SizeHint; use futures::Poll; diff --git a/tokio-buf/src/u8.rs b/tokio-buf/src/u8.rs index 4b1bc58e..5baf9d8e 100644 --- a/tokio-buf/src/u8.rs +++ b/tokio-buf/src/u8.rs @@ -1,8 +1,8 @@ +use crate::never::Never; +use crate::BufStream; use bytes::{Bytes, BytesMut}; use futures::Poll; -use never::Never; use std::io; -use BufStream; impl BufStream for Vec<u8> { type Item = io::Cursor<Vec<u8>>; diff --git a/tokio-buf/src/util/chain.rs b/tokio-buf/src/util/chain.rs index 44fc4008..58e17ca5 100644 --- a/tokio-buf/src/util/chain.rs +++ b/tokio-buf/src/util/chain.rs @@ -1,7 +1,7 @@ -use BufStream; +use crate::BufStream; use either::Either; -use futures::Poll; +use futures::{try_ready, Poll}; /// A buf stream that sequences two buf streams together. /// diff --git a/tokio-buf/src/util/collect.rs b/tokio-buf/src/util/collect.rs index d4bc57e6..5ed0462c 100644 --- a/tokio-buf/src/util/collect.rs +++ b/tokio-buf/src/util/collect.rs @@ -1,7 +1,7 @@ use super::FromBufStream; -use BufStream; +use crate::BufStream; -use futures::{Future, Poll}; +use futures::{try_ready, Future, Poll}; /// Consumes a buf stream, collecting the data into a single byte container. /// diff --git a/tokio-buf/src/util/from.rs b/tokio-buf/src/util/from.rs index debebb16..05f047be 100644 --- a/tokio-buf/src/util/from.rs +++ b/tokio-buf/src/util/from.rs @@ -1,4 +1,4 @@ -use SizeHint; +use crate::SizeHint; use bytes::{Buf, BufMut, Bytes}; @@ -138,7 +138,7 @@ impl<T: Buf> FromBufStream<T> for Bytes { } impl fmt::Display for CollectVecError { - fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { write!(fmt, "BufStream is too big") } } @@ -150,7 +150,7 @@ impl Error for CollectVecError { } impl fmt::Display for CollectBytesError { - fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { write!(fmt, "BufStream too big") } } diff --git a/tokio-buf/src/util/iter.rs b/tokio-buf/src/util/iter.rs index 0f48546a..dff4d343 100644 --- a/tokio-buf/src/util/iter.rs +++ b/tokio-buf/src/util/iter.rs @@ -1,8 +1,8 @@ +use crate::BufStream; use bytes::Buf; use futures::Poll; use std::error::Error; use std::fmt; -use BufStream; /// Converts an `Iterator` into a `BufStream` which is always ready to yield the /// next value. @@ -42,7 +42,7 @@ where } impl fmt::Display for Never { - fn fmt(&self, _: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, _: &mut fmt::Formatter<'_>) -> fmt::Result { unreachable!(); } } diff --git a/tokio-buf/src/util/limit.rs b/tokio-buf/src/util/limit.rs index c89e687a..03c0d913 100644 --- a/tokio-buf/src/util/limit.rs +++ b/tokio-buf/src/util/limit.rs @@ -1,4 +1,4 @@ -use BufStream; +use crate::BufStream; use bytes::Buf; use futures::Poll; diff --git a/tokio-buf/src/util/mod.rs b/tokio-buf/src/util/mod.rs index 14c63183..d6848e88 100644 --- a/tokio-buf/src/util/mod.rs +++ b/tokio-buf/src/util/mod.rs @@ -22,7 +22,7 @@ pub mod error { pub use super::limit::LimitError; } -use BufStream; +use crate::BufStream; impl<T> BufStreamExt for T where T: BufStream {} diff --git a/tokio-buf/src/util/stream.rs b/tokio-buf/src/util/stream.rs index 8716f23b..25af75b3 100644 --- a/tokio-buf/src/util/stream.rs +++ b/tokio-buf/src/util/stream.rs @@ -1,6 +1,6 @@ +use crate::BufStream; use bytes::Buf; use futures::{Async, Poll, Stream}; -use BufStream; /// Converts a `Stream` of `Buf` types into a `BufStream`. /// |