Skip to content

Commit

Permalink
Deny warnings for doc tests (#391)
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed May 23, 2020
1 parent 08ec01d commit e9877e7
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/buf/ext/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub trait BufExt: Buf {
/// # Examples
///
/// ```
/// use bytes::{Buf, BufMut, buf::BufExt};
/// use bytes::{BufMut, buf::BufExt};
///
/// let mut buf = b"hello world"[..].take(5);
/// let mut dst = vec![];
Expand Down Expand Up @@ -79,7 +79,7 @@ pub trait BufExt: Buf {
/// # Examples
///
/// ```
/// use bytes::{Buf, Bytes, buf::BufExt};
/// use bytes::{Bytes, buf::BufExt};
/// use std::io::Read;
///
/// let buf = Bytes::from("hello world");
Expand Down Expand Up @@ -135,7 +135,7 @@ pub trait BufMutExt: BufMut {
/// # Examples
///
/// ```
/// use bytes::{BufMut, buf::BufMutExt};
/// use bytes::buf::BufMutExt;
/// use std::io::Write;
///
/// let mut buf = vec![].writer();
Expand Down
2 changes: 1 addition & 1 deletion src/buf/ext/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ impl<B: Buf> Reader<B> {
/// ```rust
/// use bytes::buf::BufExt;
///
/// let mut buf = b"hello world".reader();
/// let buf = b"hello world".reader();
///
/// assert_eq!(b"hello world", buf.get_ref());
/// ```
Expand Down
6 changes: 3 additions & 3 deletions src/buf/ext/take.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl<T> Take<T> {
/// # Examples
///
/// ```rust
/// use bytes::buf::{Buf, BufMut, BufExt};
/// use bytes::buf::{BufMut, BufExt};
///
/// let mut buf = b"hello world".take(2);
/// let mut dst = vec![];
Expand All @@ -49,7 +49,7 @@ impl<T> Take<T> {
/// ```rust
/// use bytes::{Buf, buf::BufExt};
///
/// let mut buf = b"hello world".take(2);
/// let buf = b"hello world".take(2);
///
/// assert_eq!(11, buf.get_ref().remaining());
/// ```
Expand Down Expand Up @@ -110,7 +110,7 @@ impl<T> Take<T> {
/// # Examples
///
/// ```rust
/// use bytes::{Buf, BufMut, buf::BufExt};
/// use bytes::{BufMut, buf::BufExt};
///
/// let mut buf = b"hello world".take(2);
/// let mut dst = vec![];
Expand Down
2 changes: 1 addition & 1 deletion src/buf/ext/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ impl<B: BufMut> Writer<B> {
/// ```rust
/// use bytes::buf::BufMutExt;
///
/// let mut buf = Vec::with_capacity(1024).writer();
/// let buf = Vec::with_capacity(1024).writer();
///
/// assert_eq!(1024, buf.get_ref().capacity());
/// ```
Expand Down
5 changes: 3 additions & 2 deletions src/buf/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::Buf;
/// Basic usage:
///
/// ```
/// use bytes::{Buf, Bytes};
/// use bytes::Bytes;
///
/// let buf = Bytes::from(&b"abc"[..]);
/// let mut iter = buf.into_iter();
Expand All @@ -33,7 +33,7 @@ impl<T> IntoIter<T> {
/// # Examples
///
/// ```
/// use bytes::{Buf, Bytes};
/// use bytes::Bytes;
/// use bytes::buf::IntoIter;
///
/// let buf = Bytes::from_static(b"abc");
Expand All @@ -47,6 +47,7 @@ impl<T> IntoIter<T> {
pub fn new(inner: T) -> IntoIter<T> {
IntoIter { inner }
}

/// Consumes this `IntoIter`, returning the underlying value.
///
/// # Examples
Expand Down
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
missing_debug_implementations,
rust_2018_idioms
)]
#![doc(test(
no_crate_inject,
attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables))
))]
#![doc(html_root_url = "https://docs.rs/bytes/0.5.4")]
#![no_std]

Expand Down

0 comments on commit e9877e7

Please sign in to comment.