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
+1 -1
View File
@@ -71,7 +71,7 @@ pub struct Spawn(());
/// ```
/// use tokio::net::TcpListener;
///
/// # async fn process<T>(t: T) {}
/// # async fn process<T>(_t: T) {}
/// # async fn dox() -> Result<(), Box<dyn std::error::Error>> {
/// let mut listener = TcpListener::bind("127.0.0.1:8080").await?;
///
+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))
))]
//! A runtime for writing reliable, asynchronous, and slim applications.
//!
+3 -5
View File
@@ -25,14 +25,13 @@
//!
//! ```
//! use tokio::runtime::current_thread::Runtime;
//! use tokio::prelude::*;
//! use std::thread;
//!
//! let mut runtime = Runtime::new().unwrap();
//! let runtime = Runtime::new().unwrap();
//! let handle = runtime.handle();
//!
//! thread::spawn(move || {
//! handle.spawn(async {
//! let _ = handle.spawn(async {
//! println!("hello world");
//! });
//! }).join().unwrap();
@@ -45,9 +44,8 @@
//!
//! ```
//! use tokio::runtime::current_thread::Runtime;
//! use tokio::prelude::*;
//!
//! let mut runtime = Runtime::new().unwrap();
//! let runtime = Runtime::new().unwrap();
//!
//! // Use the runtime...
//! // runtime.block_on(f); // where f is a future
+1 -1
View File
@@ -86,7 +86,7 @@
//!
//! fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // Create the runtime
//! let mut rt = Runtime::new()?;
//! let rt = Runtime::new()?;
//!
//! // Spawn the root task
//! rt.block_on(async {
+7 -7
View File
@@ -35,7 +35,7 @@ use std::any::Any;
///
/// fn main() {
/// // build Runtime
/// let mut runtime = Builder::new()
/// let runtime = Builder::new()
/// .blocking_threads(4)
/// .clock(Clock::system())
/// .core_threads(4)
@@ -99,7 +99,7 @@ impl Builder {
/// # use tokio::runtime;
///
/// # pub fn main() {
/// let mut rt = runtime::Builder::new()
/// let rt = runtime::Builder::new()
/// .panic_handler(|err| std::panic::resume_unwind(err))
/// .build()
/// .unwrap();
@@ -127,7 +127,7 @@ impl Builder {
/// # use tokio::runtime;
///
/// # pub fn main() {
/// let mut rt = runtime::Builder::new()
/// let rt = runtime::Builder::new()
/// .core_threads(4)
/// .build()
/// .unwrap();
@@ -157,7 +157,7 @@ impl Builder {
/// # use tokio::runtime;
///
/// # pub fn main() {
/// let mut rt = runtime::Builder::new()
/// let rt = runtime::Builder::new()
/// .blocking_threads(200)
/// .build();
/// # }
@@ -186,7 +186,7 @@ impl Builder {
/// use std::time::Duration;
///
/// # pub fn main() {
/// let mut rt = runtime::Builder::new()
/// let rt = runtime::Builder::new()
/// .keep_alive(Some(Duration::from_secs(30)))
/// .build();
/// # }
@@ -210,7 +210,7 @@ impl Builder {
/// # use tokio::runtime;
///
/// # pub fn main() {
/// let mut rt = runtime::Builder::new()
/// let rt = runtime::Builder::new()
/// .name_prefix("my-pool-")
/// .build();
/// # }
@@ -234,7 +234,7 @@ impl Builder {
/// # use tokio::runtime;
///
/// # pub fn main() {
/// let mut rt = runtime::Builder::new()
/// let rt = runtime::Builder::new()
/// .stack_size(32 * 1024)
/// .build();
/// # }
-3
View File
@@ -75,7 +75,6 @@ impl Runtime {
///
/// ```
/// use tokio::runtime::Runtime;
/// use tokio::prelude::*;
///
/// let rt = Runtime::new()
/// .unwrap();
@@ -198,7 +197,6 @@ impl Runtime {
///
/// ```
/// use tokio::runtime::Runtime;
/// use tokio::prelude::*;
///
/// let rt = Runtime::new()
/// .unwrap();
@@ -239,7 +237,6 @@ impl Runtime {
///
/// ```
/// use tokio::runtime::Runtime;
/// use tokio::prelude::*;
///
/// let rt = Runtime::new()
/// .unwrap();
@@ -33,7 +33,7 @@ impl TaskExecutor {
///
/// # fn dox() {
/// // Create the runtime
/// let mut rt = Runtime::new().unwrap();
/// let rt = Runtime::new().unwrap();
/// let executor = rt.executor();
///
/// // Spawn a future onto the runtime
+1 -2
View File
@@ -30,10 +30,9 @@
//! Wait 100ms and print "Hello World!"
//!
//! ```
//! use tokio::prelude::*;
//! use tokio::timer::delay;
//!
//! use std::time::{Duration, Instant};
//! use std::time::Duration;
//!
//!
//! #[tokio::main]