mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
Dont prefix 0x when dbg!(ipv6)
This commit is contained in:
parent
6b66749e17
commit
116b66ad49
@ -1611,10 +1611,10 @@ impl fmt::Display for Ipv6Addr {
|
||||
#[inline]
|
||||
fn fmt_subslice(f: &mut fmt::Formatter<'_>, chunk: &[u16]) -> fmt::Result {
|
||||
if let Some((first, tail)) = chunk.split_first() {
|
||||
fmt::LowerHex::fmt(first, f)?;
|
||||
write!(f, "{:x}", first)?;
|
||||
for segment in tail {
|
||||
f.write_char(':')?;
|
||||
fmt::LowerHex::fmt(segment, f)?;
|
||||
write!(f, "{:x}", segment)?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
|
@ -166,6 +166,9 @@ fn ipv6_addr_to_string() {
|
||||
|
||||
// two runs of zeros, equal length
|
||||
assert_eq!("1::4:5:0:0:8", Ipv6Addr::new(1, 0, 0, 4, 5, 0, 0, 8).to_string());
|
||||
|
||||
// don't prefix `0x` to each segment in `dbg!`.
|
||||
assert_eq!("1::4:5:0:0:8", &format!("{:#?}", Ipv6Addr::new(1, 0, 0, 4, 5, 0, 0, 8)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
Loading…
Reference in New Issue
Block a user