Skip to content

Commit e9877e7

Browse files
authored
Deny warnings for doc tests (#391)
1 parent 08ec01d commit e9877e7

6 files changed

Lines changed: 15 additions & 10 deletions

File tree

‎src/buf/ext/mod.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub trait BufExt: Buf {
2727
/// # Examples
2828
///
2929
/// ```
30-
/// use bytes::{Buf, BufMut, buf::BufExt};
30+
/// use bytes::{BufMut, buf::BufExt};
3131
///
3232
/// let mut buf = b"hello world"[..].take(5);
3333
/// let mut dst = vec![];
@@ -79,7 +79,7 @@ pub trait BufExt: Buf {
7979
/// # Examples
8080
///
8181
/// ```
82-
/// use bytes::{Buf, Bytes, buf::BufExt};
82+
/// use bytes::{Bytes, buf::BufExt};
8383
/// use std::io::Read;
8484
///
8585
/// let buf = Bytes::from("hello world");
@@ -135,7 +135,7 @@ pub trait BufMutExt: BufMut {
135135
/// # Examples
136136
///
137137
/// ```
138-
/// use bytes::{BufMut, buf::BufMutExt};
138+
/// use bytes::buf::BufMutExt;
139139
/// use std::io::Write;
140140
///
141141
/// let mut buf = vec![].writer();

‎src/buf/ext/reader.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ impl<B: Buf> Reader<B> {
2626
/// ```rust
2727
/// use bytes::buf::BufExt;
2828
///
29-
/// let mut buf = b"hello world".reader();
29+
/// let buf = b"hello world".reader();
3030
///
3131
/// assert_eq!(b"hello world", buf.get_ref());
3232
/// ```

‎src/buf/ext/take.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ impl<T> Take<T> {
2222
/// # Examples
2323
///
2424
/// ```rust
25-
/// use bytes::buf::{Buf, BufMut, BufExt};
25+
/// use bytes::buf::{BufMut, BufExt};
2626
///
2727
/// let mut buf = b"hello world".take(2);
2828
/// let mut dst = vec![];
@@ -49,7 +49,7 @@ impl<T> Take<T> {
4949
/// ```rust
5050
/// use bytes::{Buf, buf::BufExt};
5151
///
52-
/// let mut buf = b"hello world".take(2);
52+
/// let buf = b"hello world".take(2);
5353
///
5454
/// assert_eq!(11, buf.get_ref().remaining());
5555
/// ```
@@ -110,7 +110,7 @@ impl<T> Take<T> {
110110
/// # Examples
111111
///
112112
/// ```rust
113-
/// use bytes::{Buf, BufMut, buf::BufExt};
113+
/// use bytes::{BufMut, buf::BufExt};
114114
///
115115
/// let mut buf = b"hello world".take(2);
116116
/// let mut dst = vec![];

‎src/buf/ext/writer.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ impl<B: BufMut> Writer<B> {
2626
/// ```rust
2727
/// use bytes::buf::BufMutExt;
2828
///
29-
/// let mut buf = Vec::with_capacity(1024).writer();
29+
/// let buf = Vec::with_capacity(1024).writer();
3030
///
3131
/// assert_eq!(1024, buf.get_ref().capacity());
3232
/// ```

‎src/buf/iter.rs‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use crate::Buf;
99
/// Basic usage:
1010
///
1111
/// ```
12-
/// use bytes::{Buf, Bytes};
12+
/// use bytes::Bytes;
1313
///
1414
/// let buf = Bytes::from(&b"abc"[..]);
1515
/// let mut iter = buf.into_iter();
@@ -33,7 +33,7 @@ impl<T> IntoIter<T> {
3333
/// # Examples
3434
///
3535
/// ```
36-
/// use bytes::{Buf, Bytes};
36+
/// use bytes::Bytes;
3737
/// use bytes::buf::IntoIter;
3838
///
3939
/// let buf = Bytes::from_static(b"abc");
@@ -47,6 +47,7 @@ impl<T> IntoIter<T> {
4747
pub fn new(inner: T) -> IntoIter<T> {
4848
IntoIter { inner }
4949
}
50+
5051
/// Consumes this `IntoIter`, returning the underlying value.
5152
///
5253
/// # Examples

‎src/lib.rs‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
missing_debug_implementations,
55
rust_2018_idioms
66
)]
7+
#![doc(test(
8+
no_crate_inject,
9+
attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables))
10+
))]
711
#![doc(html_root_url = "https://docs.rs/bytes/0.5.4")]
812
#![no_std]
913

0 commit comments

Comments
 (0)