chore: deny warnings for doc tests (#1539)

This commit is contained in:
Taiki Endo
2019-09-19 15:50:12 +09:00
committed by GitHub
parent e2161502ad
commit d1f60ac4c6
30 changed files with 81 additions and 53 deletions
+4 -1
View File
@@ -6,7 +6,10 @@
unreachable_pub
)]
#![deny(intra_doc_link_resolution_failure)]
#![doc(test(no_crate_inject, attr(deny(rust_2018_idioms))))]
#![doc(test(
no_crate_inject,
attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables))
))]
//! Utilities for tracking time.
//!
+7 -5
View File
@@ -38,7 +38,7 @@ use std::time::{Duration, Instant};
/// use std::thread;
/// use std::time::Duration;
///
/// # async fn dox() {
/// # async fn dox() -> Result<(), Box<dyn std::error::Error>> {
/// let (mut tx, rx) = mpsc::unbounded_channel();
///
/// thread::spawn(move || {
@@ -54,7 +54,8 @@ use std::time::{Duration, Instant};
/// });
///
/// // Wrap the future with a `Timeout` set to expire in 10 milliseconds.
/// process.timeout(Duration::from_millis(10)).await;
/// process.timeout(Duration::from_millis(10)).await?;
/// # Ok(())
/// # }
/// ```
///
@@ -99,13 +100,14 @@ impl<T> Timeout<T> {
///
/// use std::time::Duration;
///
/// # async fn dox() {
/// # async fn dox() -> Result<(), Box<dyn std::error::Error>> {
/// let (tx, rx) = oneshot::channel();
/// # tx.send(()).unwrap();
///
/// // Wrap the future with a `Timeout` set to expire in 10 milliseconds.
/// Timeout::new(rx, Duration::from_millis(10)).await;
/// }
/// Timeout::new(rx, Duration::from_millis(10)).await??;
/// # Ok(())
/// # }
/// ```
pub fn new(value: T, timeout: Duration) -> Timeout<T> {
let delay = Delay::new_timeout(now() + timeout, timeout);