Skip to content

Commit eccfa19

Browse files
taiki-ecramertj
authored andcommitted
Deny warnings for doc tests
1 parent b232653 commit eccfa19

File tree

26 files changed

+68
-55
lines changed

26 files changed

+68
-55
lines changed

futures-channel/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#![warn(missing_docs, missing_debug_implementations, rust_2018_idioms, unreachable_pub)]
1212
#![warn(clippy::all)]
1313

14+
#![doc(test(attr(deny(warnings), allow(dead_code, unused_assignments, unused_variables))))]
15+
1416
#![doc(html_root_url = "https://rust-lang-nursery.github.io/futures-api-docs/0.3.0-alpha.16/futures_channel")]
1517

1618
#[cfg(feature = "std")]

futures-core/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#![warn(missing_docs, missing_debug_implementations, rust_2018_idioms, unreachable_pub)]
88
#![warn(clippy::all)]
99

10+
#![doc(test(attr(deny(warnings), allow(dead_code, unused_assignments, unused_variables))))]
11+
1012
#![doc(html_root_url = "https://rust-lang-nursery.github.io/futures-api-docs/0.3.0-alpha.16/futures_core")]
1113

1214
#[cfg(all(feature = "cfg-target-has-atomic", not(feature = "nightly")))]

futures-core/src/task/__internal/atomic_waker.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ impl AtomicWaker {
183183
/// impl Future for Flag {
184184
/// type Output = ();
185185
///
186-
/// fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<()> {
186+
/// fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<()> {
187187
/// // Register **before** checking `set` to avoid a race condition
188188
/// // that would result in lost notifications.
189189
/// self.waker.register(cx.waker());

futures-executor/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
#![warn(missing_docs, missing_debug_implementations, rust_2018_idioms, unreachable_pub)]
99
#![warn(clippy::all)]
1010

11+
#![doc(test(attr(deny(warnings), allow(dead_code, unused_assignments, unused_variables))))]
12+
1113
#![doc(html_root_url = "https://rust-lang-nursery.github.io/futures-api-docs/0.3.0-alpha.16/futures_executor")]
1214

1315
#[cfg(feature = "std")]

futures-executor/src/local_pool.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -175,16 +175,16 @@ impl LocalPool {
175175
/// let mut pool = LocalPool::new();
176176
/// let mut spawner = pool.spawner();
177177
///
178-
/// spawner.spawn_local(ready(()));
179-
/// spawner.spawn_local(ready(()));
180-
/// spawner.spawn_local(empty());
178+
/// spawner.spawn_local(ready(())).unwrap();
179+
/// spawner.spawn_local(ready(())).unwrap();
180+
/// spawner.spawn_local(empty()).unwrap();
181181
///
182182
/// // Run the two ready tasks and return true for them.
183183
/// pool.try_run_one(); // returns true after completing one of the ready futures
184184
/// pool.try_run_one(); // returns true after completing the other ready future
185185
///
186186
/// // the remaining task can not be completed
187-
/// pool.try_run_one(); // returns false
187+
/// assert!(!pool.try_run_one()); // returns false
188188
/// ```
189189
///
190190
/// This function will not block the calling thread and will return the moment
@@ -215,9 +215,9 @@ impl LocalPool {
215215
/// let mut pool = LocalPool::new();
216216
/// let mut spawner = pool.spawner();
217217
///
218-
/// spawner.spawn_local(ready(()));
219-
/// spawner.spawn_local(ready(()));
220-
/// spawner.spawn_local(empty());
218+
/// spawner.spawn_local(ready(())).unwrap();
219+
/// spawner.spawn_local(ready(())).unwrap();
220+
/// spawner.spawn_local(empty()).unwrap();
221221
///
222222
/// // Runs the two ready task and returns.
223223
/// // The empty task remains in the pool.

futures-io/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#![warn(missing_docs, missing_debug_implementations, rust_2018_idioms, unreachable_pub)]
1414
#![warn(clippy::all)]
1515

16+
#![doc(test(attr(deny(warnings), allow(dead_code, unused_assignments, unused_variables))))]
17+
1618
#![doc(html_root_url = "https://rust-lang-nursery.github.io/futures-api-docs/0.3.0-alpha.16/futures_io")]
1719

1820
#[cfg(feature = "std")]

futures-sink/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#![warn(missing_docs, missing_debug_implementations, rust_2018_idioms, unreachable_pub)]
88
#![warn(clippy::all)]
99

10+
#![doc(test(attr(deny(warnings), allow(dead_code, unused_assignments, unused_variables))))]
11+
1012
#![doc(html_root_url = "https://rust-lang-nursery.github.io/futures-api-docs/0.3.0-alpha.16/futures_sink")]
1113

1214
#[cfg(feature = "alloc")]

futures-test/src/assert.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub fn assert_is_unpin_stream<S: Stream + Unpin>(_: &mut S) {}
1717
/// };
1818
/// use pin_utils::pin_mut;
1919
///
20-
/// let mut stream = stream::once((async { 5 }).pending_once());
20+
/// let stream = stream::once((async { 5 }).pending_once());
2121
/// pin_mut!(stream);
2222
///
2323
/// assert_stream_pending!(stream);
@@ -54,7 +54,7 @@ macro_rules! assert_stream_pending {
5454
/// };
5555
/// use pin_utils::pin_mut;
5656
///
57-
/// let mut stream = stream::once((async { 5 }).pending_once());
57+
/// let stream = stream::once((async { 5 }).pending_once());
5858
/// pin_mut!(stream);
5959
///
6060
/// assert_stream_pending!(stream);
@@ -97,7 +97,7 @@ macro_rules! assert_stream_next {
9797
/// };
9898
/// use pin_utils::pin_mut;
9999
///
100-
/// let mut stream = stream::once((async { 5 }).pending_once());
100+
/// let stream = stream::once((async { 5 }).pending_once());
101101
/// pin_mut!(stream);
102102
///
103103
/// assert_stream_pending!(stream);

futures-test/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
#![warn(missing_docs, missing_debug_implementations, rust_2018_idioms, unreachable_pub)]
44
#![warn(clippy::all)]
55

6+
#![doc(test(attr(deny(warnings), allow(dead_code, unused_assignments, unused_variables))))]
7+
68
#![doc(html_root_url = "https://rust-lang-nursery.github.io/futures-api-docs/0.3.0-alpha.16/futures_test")]
79

810
#[cfg(not(feature = "std"))]

futures-test/src/task/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub fn panic_context() -> Context<'static> {
2828
/// use futures_test::task::noop_context;
2929
/// use pin_utils::pin_mut;
3030
///
31-
/// let mut future = async { 5 };
31+
/// let future = async { 5 };
3232
/// pin_mut!(future);
3333
///
3434
/// assert_eq!(future.poll(&mut noop_context()), Poll::Ready(5));

0 commit comments

Comments
 (0)