mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-06 00:00:10 +02:00
chore: deny warnings for doc tests (#1539)
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
//! ```
|
||||
//! use tokio::net::TcpStream;
|
||||
//!
|
||||
//! # async fn process<T>(t: T) {}
|
||||
//! # async fn process<T>(_t: T) {}
|
||||
//! # async fn dox() -> Result<(), Box<dyn std::error::Error>> {
|
||||
//! let stream = TcpStream::connect("93.184.216.34:9243").await?;
|
||||
//!
|
||||
|
||||
@@ -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))
|
||||
))]
|
||||
|
||||
//! Event loop that drives Tokio I/O resources.
|
||||
//!
|
||||
|
||||
@@ -25,7 +25,7 @@ use std::task::{Context, Poll};
|
||||
/// use tokio::net::TcpListener;
|
||||
///
|
||||
/// use std::io;
|
||||
/// # async fn process_socket<T>(socket: T) {}
|
||||
/// # async fn process_socket<T>(_socket: T) {}
|
||||
///
|
||||
/// #[tokio::main]
|
||||
/// async fn main() -> io::Result<()> {
|
||||
@@ -33,7 +33,7 @@ use std::task::{Context, Poll};
|
||||
///
|
||||
/// loop {
|
||||
/// let (socket, _) = listener.accept().await?;
|
||||
/// process_socket(socket);
|
||||
/// process_socket(socket).await;
|
||||
/// }
|
||||
/// }
|
||||
/// ```
|
||||
@@ -70,6 +70,7 @@ impl TcpListener {
|
||||
///
|
||||
/// // use the listener
|
||||
///
|
||||
/// # let _ = listener;
|
||||
/// Ok(())
|
||||
/// }
|
||||
/// ```
|
||||
@@ -197,6 +198,7 @@ impl TcpListener {
|
||||
///
|
||||
/// let std_listener = StdTcpListener::bind("127.0.0.1:0")?;
|
||||
/// let listener = TcpListener::from_std(std_listener, &Handle::default())?;
|
||||
/// # let _ = listener;
|
||||
/// # Ok::<_, Box<dyn std::error::Error>>(())
|
||||
/// ```
|
||||
pub fn from_std(listener: net::TcpListener, handle: &Handle) -> io::Result<TcpListener> {
|
||||
|
||||
@@ -270,14 +270,13 @@ impl TcpStream {
|
||||
///
|
||||
/// ```no_run
|
||||
/// use tokio::net::TcpStream;
|
||||
/// use tokio::prelude::*;
|
||||
/// use std::error::Error;
|
||||
/// use std::net::Shutdown;
|
||||
///
|
||||
/// #[tokio::main]
|
||||
/// async fn main() -> Result<(), Box<dyn Error>> {
|
||||
/// // Connect to a peer
|
||||
/// let mut stream = TcpStream::connect("127.0.0.1:8080").await?;
|
||||
/// let stream = TcpStream::connect("127.0.0.1:8080").await?;
|
||||
///
|
||||
/// // Shutdown the stream
|
||||
/// stream.shutdown(Shutdown::Write)?;
|
||||
|
||||
@@ -76,7 +76,7 @@ use std::task::{Context, Poll};
|
||||
/// match self.poll_evented.get_ref().accept() {
|
||||
/// Ok((socket, _)) => Poll::Ready(Ok(socket)),
|
||||
/// Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => {
|
||||
/// self.poll_evented.clear_read_ready(cx, ready);
|
||||
/// self.poll_evented.clear_read_ready(cx, ready)?;
|
||||
/// Poll::Pending
|
||||
/// }
|
||||
/// Err(e) => Poll::Ready(Err(e)),
|
||||
|
||||
Reference in New Issue
Block a user