We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Display
Ipv6Addr
1 parent b8ded01 commit 7e631d9Copy full SHA for 7e631d9
core/src/net/ip_addr.rs
@@ -1770,14 +1770,8 @@ impl fmt::Display for Ipv6Addr {
1770
f.write_str("::")
1771
} else if self.is_loopback() {
1772
f.write_str("::1")
1773
- } else if let Some(ipv4) = self.to_ipv4() {
1774
- match segments[5] {
1775
- // IPv4 Compatible address
1776
- 0 => write!(f, "::{}", ipv4),
1777
- // IPv4 Mapped address
1778
- 0xffff => write!(f, "::ffff:{}", ipv4),
1779
- _ => unreachable!(),
1780
- }
+ } else if let Some(ipv4) = self.to_ipv4_mapped() {
+ write!(f, "::ffff:{}", ipv4)
1781
} else {
1782
#[derive(Copy, Clone, Default)]
1783
struct Span {
0 commit comments