Deny warnings for doc tests (#391)

This commit is contained in:
Taiki Endo
2020-05-24 06:30:50 +09:00
committed by GitHub
parent 08ec01d1e7
commit e9877e7a3d
6 changed files with 15 additions and 10 deletions
+3 -3
View File
@@ -27,7 +27,7 @@ pub trait BufExt: Buf {
/// # Examples /// # Examples
/// ///
/// ``` /// ```
/// use bytes::{Buf, BufMut, buf::BufExt}; /// use bytes::{BufMut, buf::BufExt};
/// ///
/// let mut buf = b"hello world"[..].take(5); /// let mut buf = b"hello world"[..].take(5);
/// let mut dst = vec![]; /// let mut dst = vec![];
@@ -79,7 +79,7 @@ pub trait BufExt: Buf {
/// # Examples /// # Examples
/// ///
/// ``` /// ```
/// use bytes::{Buf, Bytes, buf::BufExt}; /// use bytes::{Bytes, buf::BufExt};
/// use std::io::Read; /// use std::io::Read;
/// ///
/// let buf = Bytes::from("hello world"); /// let buf = Bytes::from("hello world");
@@ -135,7 +135,7 @@ pub trait BufMutExt: BufMut {
/// # Examples /// # Examples
/// ///
/// ``` /// ```
/// use bytes::{BufMut, buf::BufMutExt}; /// use bytes::buf::BufMutExt;
/// use std::io::Write; /// use std::io::Write;
/// ///
/// let mut buf = vec![].writer(); /// let mut buf = vec![].writer();
+1 -1
View File
@@ -26,7 +26,7 @@ impl<B: Buf> Reader<B> {
/// ```rust /// ```rust
/// use bytes::buf::BufExt; /// 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()); /// assert_eq!(b"hello world", buf.get_ref());
/// ``` /// ```
+3 -3
View File
@@ -22,7 +22,7 @@ impl<T> Take<T> {
/// # Examples /// # Examples
/// ///
/// ```rust /// ```rust
/// use bytes::buf::{Buf, BufMut, BufExt}; /// use bytes::buf::{BufMut, BufExt};
/// ///
/// let mut buf = b"hello world".take(2); /// let mut buf = b"hello world".take(2);
/// let mut dst = vec![]; /// let mut dst = vec![];
@@ -49,7 +49,7 @@ impl<T> Take<T> {
/// ```rust /// ```rust
/// use bytes::{Buf, buf::BufExt}; /// 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()); /// assert_eq!(11, buf.get_ref().remaining());
/// ``` /// ```
@@ -110,7 +110,7 @@ impl<T> Take<T> {
/// # Examples /// # Examples
/// ///
/// ```rust /// ```rust
/// use bytes::{Buf, BufMut, buf::BufExt}; /// use bytes::{BufMut, buf::BufExt};
/// ///
/// let mut buf = b"hello world".take(2); /// let mut buf = b"hello world".take(2);
/// let mut dst = vec![]; /// let mut dst = vec![];
+1 -1
View File
@@ -26,7 +26,7 @@ impl<B: BufMut> Writer<B> {
/// ```rust /// ```rust
/// use bytes::buf::BufMutExt; /// 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()); /// assert_eq!(1024, buf.get_ref().capacity());
/// ``` /// ```
+3 -2
View File
@@ -9,7 +9,7 @@ use crate::Buf;
/// Basic usage: /// Basic usage:
/// ///
/// ``` /// ```
/// use bytes::{Buf, Bytes}; /// use bytes::Bytes;
/// ///
/// let buf = Bytes::from(&b"abc"[..]); /// let buf = Bytes::from(&b"abc"[..]);
/// let mut iter = buf.into_iter(); /// let mut iter = buf.into_iter();
@@ -33,7 +33,7 @@ impl<T> IntoIter<T> {
/// # Examples /// # Examples
/// ///
/// ``` /// ```
/// use bytes::{Buf, Bytes}; /// use bytes::Bytes;
/// use bytes::buf::IntoIter; /// use bytes::buf::IntoIter;
/// ///
/// let buf = Bytes::from_static(b"abc"); /// let buf = Bytes::from_static(b"abc");
@@ -47,6 +47,7 @@ impl<T> IntoIter<T> {
pub fn new(inner: T) -> IntoIter<T> { pub fn new(inner: T) -> IntoIter<T> {
IntoIter { inner } IntoIter { inner }
} }
/// Consumes this `IntoIter`, returning the underlying value. /// Consumes this `IntoIter`, returning the underlying value.
/// ///
/// # Examples /// # Examples
+4
View File
@@ -4,6 +4,10 @@
missing_debug_implementations, missing_debug_implementations,
rust_2018_idioms 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")] #![doc(html_root_url = "https://docs.rs/bytes/0.5.4")]
#![no_std] #![no_std]