diff --git a/library/std/src/net/addr.rs b/library/std/src/net/addr.rs index 8c8d1aadf48e2..4f751656e09c8 100644 --- a/library/std/src/net/addr.rs +++ b/library/std/src/net/addr.rs @@ -37,7 +37,7 @@ use crate::vec; /// assert_eq!(socket.port(), 8080); /// assert_eq!(socket.is_ipv4(), true); /// ``` -#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, PartialOrd, Ord)] +#[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)] #[stable(feature = "rust1", since = "1.0.0")] pub enum SocketAddr { /// An IPv4 socket address. @@ -597,6 +597,13 @@ impl fmt::Display for SocketAddr { } } +#[stable(feature = "rust1", since = "1.0.0")] +impl fmt::Debug for SocketAddr { + fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { + fmt::Display::fmt(self, fmt) + } +} + #[stable(feature = "rust1", since = "1.0.0")] impl fmt::Display for SocketAddrV4 { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { diff --git a/library/std/src/net/ip.rs b/library/std/src/net/ip.rs index 2c0025bcba069..9d7b2b807636f 100644 --- a/library/std/src/net/ip.rs +++ b/library/std/src/net/ip.rs @@ -40,7 +40,7 @@ use crate::sys_common::{AsInner, FromInner}; /// assert_eq!(localhost_v4.is_ipv4(), true); /// ``` #[stable(feature = "ip_addr", since = "1.7.0")] -#[derive(Copy, Clone, Eq, PartialEq, Debug, Hash, PartialOrd, Ord)] +#[derive(Copy, Clone, Eq, PartialEq, Hash, PartialOrd, Ord)] pub enum IpAddr { /// An IPv4 address. #[stable(feature = "ip_addr", since = "1.7.0")] @@ -802,6 +802,13 @@ impl fmt::Display for IpAddr { } } +#[stable(feature = "ip_addr", since = "1.7.0")] +impl fmt::Debug for IpAddr { + fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { + fmt::Display::fmt(self, fmt) + } +} + #[stable(feature = "ip_from_ip", since = "1.16.0")] impl From for IpAddr { /// Copies this address to a new `IpAddr::V4`.