summaryrefslogtreecommitdiffstats
path: root/tokio
diff options
context:
space:
mode:
authorTaiki Endo <te316e89@gmail.com>2019-09-19 15:50:12 +0900
committerGitHub <noreply@github.com>2019-09-19 15:50:12 +0900
commitd1f60ac4c69792211f9c9f3bcff1559bc0cb837a (patch)
tree8692e2b1b29c8311fff25ad6563be72e9d5853da /tokio
parente2161502ad4a8af4845e8286b5b651da27bbd3f6 (diff)
chore: deny warnings for doc tests (#1539)
Diffstat (limited to 'tokio')
-rw-r--r--tokio/src/executor.rs2
-rw-r--r--tokio/src/lib.rs5
-rw-r--r--tokio/src/runtime/current_thread/mod.rs8
-rw-r--r--tokio/src/runtime/mod.rs2
-rw-r--r--tokio/src/runtime/threadpool/builder.rs14
-rw-r--r--tokio/src/runtime/threadpool/mod.rs3
-rw-r--r--tokio/src/runtime/threadpool/task_executor.rs2
-rw-r--r--tokio/src/timer.rs3
8 files changed, 18 insertions, 21 deletions
diff --git a/tokio/src/executor.rs b/tokio/src/executor.rs
index 75f0f9d4..710ed2b9 100644
--- a/tokio/src/executor.rs
+++ b/tokio/src/executor.rs
@@ -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?;
///
diff --git a/tokio/src/lib.rs b/tokio/src/lib.rs
index 68f10bc7..b9758f00 100644
--- a/tokio/src/lib.rs
+++ b/tokio/src/lib.rs
@@ -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.
//!
diff --git a/tokio/src/runtime/current_thread/mod.rs b/tokio/src/runtime/current_thread/mod.rs
index c4ed70c6..4b237d35 100644
--- a/tokio/src/runtime/current_thread/mod.rs
+++ b/tokio/src/runtime/current_thread/mod.rs
@@ -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
diff --git a/tokio/src/runtime/mod.rs b/tokio/src/runtime/mod.rs
index 4ba6663a..ee33d08c 100644
--- a/tokio/src/runtime/mod.rs
+++ b/tokio/src/runtime/mod.rs
@@ -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 {
diff --git a/tokio/src/runtime/threadpool/builder.rs b/tokio/src/runtime/threadpool/builder.rs
index d045c398..13173095 100644
--- a/tokio/src/runtime/threadpool/builder.rs
+++ b/tokio/src/runtime/threadpool/builder.rs
@@ -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();
/// # }
diff --git a/tokio/src/runtime/threadpool/mod.rs b/tokio/src/runtime/threadpool/mod.rs
index c2564cb8..47009cc4 100644
--- a/tokio/src/runtime/threadpool/mod.rs
+++ b/tokio/src/runtime/threadpool/mod.rs
@@ -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();
diff --git a/tokio/src/runtime/threadpool/task_executor.rs b/tokio/src/runtime/threadpool/task_executor.rs
index ddf764cc..3107ac11 100644
--- a/tokio/src/runtime/threadpool/task_executor.rs
+++ b/tokio/src/runtime/threadpool/task_executor.rs
@@ -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
diff --git a/tokio/src/timer.rs b/tokio/src/timer.rs
index 024903d5..eaedee27 100644
--- a/tokio/src/timer.rs
+++ b/tokio/src/timer.rs
@@ -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]