]> git.lizzy.rs Git - rust.git/blobdiff - library/std/src/net/ip.rs
Change Debug impl of SocketAddr and IpAddr to match their Display output
[rust.git] / library / std / src / net / ip.rs
index 0f0be2c4883149d60a4add91d583c6d712cf6f5f..c27a33bc1096307307431a206419f52299b6f150 100644 (file)
@@ -39,7 +39,7 @@
 /// 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")]
@@ -811,6 +811,13 @@ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
     }
 }
 
+#[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<Ipv4Addr> for IpAddr {
     /// Copies this address to a new `IpAddr::V4`.