From cf793d40534aeb0815c37b47e241d4f924cdd3c7 Mon Sep 17 00:00:00 2001 From: Thomas de Zeeuw Date: Wed, 6 Dec 2017 17:19:21 +0100 Subject: [PATCH] Derive debug on public structs (#62) * Derive Debug on all public structs * Enable a warning about missing debug implementations on public struct --- src/lib.rs | 1 + src/net/tcp.rs | 3 +++ src/net/udp/frame.rs | 1 + src/net/udp/mod.rs | 2 ++ 4 files changed, 7 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 6985add4d..d4698ca70 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -94,6 +94,7 @@ #![doc(html_root_url = "https://docs.rs/tokio-core/0.1")] #![deny(missing_docs)] #![deny(warnings)] +#![warn(missing_debug_implementations)] extern crate bytes; #[macro_use] diff --git a/src/net/tcp.rs b/src/net/tcp.rs index 1c0c88d05..445556c88 100644 --- a/src/net/tcp.rs +++ b/src/net/tcp.rs @@ -24,6 +24,7 @@ pub struct TcpListener { /// Stream returned by the `TcpListener::incoming` function representing the /// stream of sockets received from a listener. #[must_use = "streams do nothing unless polled"] +#[derive(Debug)] pub struct Incoming { inner: TcpListener, } @@ -226,11 +227,13 @@ pub struct TcpStream { /// Future returned by `TcpStream::connect` which will resolve to a `TcpStream` /// when the stream is connected. #[must_use = "futures do nothing unless polled"] +#[derive(Debug)] pub struct TcpStreamNew { inner: TcpStreamNewState, } #[must_use = "futures do nothing unless polled"] +#[derive(Debug)] enum TcpStreamNewState { Waiting(TcpStream), Error(io::Error), diff --git a/src/net/udp/frame.rs b/src/net/udp/frame.rs index 72f701975..55ef77822 100644 --- a/src/net/udp/frame.rs +++ b/src/net/udp/frame.rs @@ -56,6 +56,7 @@ pub trait UdpCodec { /// You can acquire a `UdpFramed` instance by using the `UdpSocket::framed` /// adapter. #[must_use = "sinks do nothing unless polled"] +#[derive(Debug)] pub struct UdpFramed { socket: UdpSocket, codec: C, diff --git a/src/net/udp/mod.rs b/src/net/udp/mod.rs index 11f4400cc..2b5287ed1 100644 --- a/src/net/udp/mod.rs +++ b/src/net/udp/mod.rs @@ -405,6 +405,7 @@ impl fmt::Debug for UdpSocket { /// /// This is created by the `UdpSocket::send_dgram` method. #[must_use = "futures do nothing unless polled"] +#[derive(Debug)] pub struct SendDgram(Option<(UdpSocket, T, SocketAddr)>); fn incomplete_write(reason: &str) -> io::Error { @@ -437,6 +438,7 @@ impl Future for SendDgram /// /// This is created by the `UdpSocket::recv_dgram` method. #[must_use = "futures do nothing unless polled"] +#[derive(Debug)] pub struct RecvDgram(Option<(UdpSocket, T)>); impl Future for RecvDgram