Skip to content

Commit 0b7e399

Browse files
committed
core/net: use hex for ipv6 doctests for consistency.
1 parent 725d1f7 commit 0b7e399

File tree

1 file changed

+25
-37
lines changed

1 file changed

+25
-37
lines changed

library/core/src/net/ip_addr.rs

+25-37
Original file line numberDiff line numberDiff line change
@@ -1427,15 +1427,13 @@ impl Ipv6Addr {
14271427
/// use std::net::Ipv6Addr;
14281428
///
14291429
/// let addr = Ipv6Addr::from_segments([
1430-
/// 525u16, 524u16, 523u16, 522u16,
1431-
/// 521u16, 520u16, 519u16, 518u16,
1430+
/// 0x20du16, 0x20cu16, 0x20bu16, 0x20au16,
1431+
/// 0x209u16, 0x208u16, 0x207u16, 0x206u16,
14321432
/// ]);
14331433
/// assert_eq!(
14341434
/// Ipv6Addr::new(
1435-
/// 0x20d, 0x20c,
1436-
/// 0x20b, 0x20a,
1437-
/// 0x209, 0x208,
1438-
/// 0x207, 0x206
1435+
/// 0x20d, 0x20c, 0x20b, 0x20a,
1436+
/// 0x209, 0x208, 0x207, 0x206,
14391437
/// ),
14401438
/// addr
14411439
/// );
@@ -1980,7 +1978,7 @@ impl Ipv6Addr {
19801978
/// use std::net::Ipv6Addr;
19811979
///
19821980
/// assert_eq!(Ipv6Addr::new(0xff00, 0, 0, 0, 0, 0, 0, 0).octets(),
1983-
/// [255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
1981+
/// [0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
19841982
/// ```
19851983
#[rustc_const_stable(feature = "const_ip_32", since = "1.32.0")]
19861984
#[stable(feature = "ipv6_to_octets", since = "1.12.0")]
@@ -1999,15 +1997,13 @@ impl Ipv6Addr {
19991997
/// use std::net::Ipv6Addr;
20001998
///
20011999
/// let addr = Ipv6Addr::from_octets([
2002-
/// 25u8, 24u8, 23u8, 22u8, 21u8, 20u8, 19u8, 18u8,
2003-
/// 17u8, 16u8, 15u8, 14u8, 13u8, 12u8, 11u8, 10u8,
2000+
/// 0x19u8, 0x18u8, 0x17u8, 0x16u8, 0x15u8, 0x14u8, 0x13u8, 0x12u8,
2001+
/// 0x11u8, 0x10u8, 0x0fu8, 0x0eu8, 0x0du8, 0x0cu8, 0x0bu8, 0x0au8,
20042002
/// ]);
20052003
/// assert_eq!(
20062004
/// Ipv6Addr::new(
2007-
/// 0x1918, 0x1716,
2008-
/// 0x1514, 0x1312,
2009-
/// 0x1110, 0x0f0e,
2010-
/// 0x0d0c, 0x0b0a
2005+
/// 0x1918, 0x1716, 0x1514, 0x1312,
2006+
/// 0x1110, 0x0f0e, 0x0d0c, 0x0b0a,
20112007
/// ),
20122008
/// addr
20132009
/// );
@@ -2190,15 +2186,13 @@ impl From<[u8; 16]> for Ipv6Addr {
21902186
/// use std::net::Ipv6Addr;
21912187
///
21922188
/// let addr = Ipv6Addr::from([
2193-
/// 25u8, 24u8, 23u8, 22u8, 21u8, 20u8, 19u8, 18u8,
2194-
/// 17u8, 16u8, 15u8, 14u8, 13u8, 12u8, 11u8, 10u8,
2189+
/// 0x19u8, 0x18u8, 0x17u8, 0x16u8, 0x15u8, 0x14u8, 0x13u8, 0x12u8,
2190+
/// 0x11u8, 0x10u8, 0x0fu8, 0x0eu8, 0x0du8, 0x0cu8, 0x0bu8, 0x0au8,
21952191
/// ]);
21962192
/// assert_eq!(
21972193
/// Ipv6Addr::new(
2198-
/// 0x1918, 0x1716,
2199-
/// 0x1514, 0x1312,
2200-
/// 0x1110, 0x0f0e,
2201-
/// 0x0d0c, 0x0b0a
2194+
/// 0x1918, 0x1716, 0x1514, 0x1312,
2195+
/// 0x1110, 0x0f0e, 0x0d0c, 0x0b0a,
22022196
/// ),
22032197
/// addr
22042198
/// );
@@ -2219,15 +2213,13 @@ impl From<[u16; 8]> for Ipv6Addr {
22192213
/// use std::net::Ipv6Addr;
22202214
///
22212215
/// let addr = Ipv6Addr::from([
2222-
/// 525u16, 524u16, 523u16, 522u16,
2223-
/// 521u16, 520u16, 519u16, 518u16,
2216+
/// 0x20du16, 0x20cu16, 0x20bu16, 0x20au16,
2217+
/// 0x209u16, 0x208u16, 0x207u16, 0x206u16,
22242218
/// ]);
22252219
/// assert_eq!(
22262220
/// Ipv6Addr::new(
2227-
/// 0x20d, 0x20c,
2228-
/// 0x20b, 0x20a,
2229-
/// 0x209, 0x208,
2230-
/// 0x207, 0x206
2221+
/// 0x20d, 0x20c, 0x20b, 0x20a,
2222+
/// 0x209, 0x208, 0x207, 0x206,
22312223
/// ),
22322224
/// addr
22332225
/// );
@@ -2249,15 +2241,13 @@ impl From<[u8; 16]> for IpAddr {
22492241
/// use std::net::{IpAddr, Ipv6Addr};
22502242
///
22512243
/// let addr = IpAddr::from([
2252-
/// 25u8, 24u8, 23u8, 22u8, 21u8, 20u8, 19u8, 18u8,
2253-
/// 17u8, 16u8, 15u8, 14u8, 13u8, 12u8, 11u8, 10u8,
2244+
/// 0x19u8, 0x18u8, 0x17u8, 0x16u8, 0x15u8, 0x14u8, 0x13u8, 0x12u8,
2245+
/// 0x11u8, 0x10u8, 0x0fu8, 0x0eu8, 0x0du8, 0x0cu8, 0x0bu8, 0x0au8,
22542246
/// ]);
22552247
/// assert_eq!(
22562248
/// IpAddr::V6(Ipv6Addr::new(
2257-
/// 0x1918, 0x1716,
2258-
/// 0x1514, 0x1312,
2259-
/// 0x1110, 0x0f0e,
2260-
/// 0x0d0c, 0x0b0a
2249+
/// 0x1918, 0x1716, 0x1514, 0x1312,
2250+
/// 0x1110, 0x0f0e, 0x0d0c, 0x0b0a,
22612251
/// )),
22622252
/// addr
22632253
/// );
@@ -2278,15 +2268,13 @@ impl From<[u16; 8]> for IpAddr {
22782268
/// use std::net::{IpAddr, Ipv6Addr};
22792269
///
22802270
/// let addr = IpAddr::from([
2281-
/// 525u16, 524u16, 523u16, 522u16,
2282-
/// 521u16, 520u16, 519u16, 518u16,
2271+
/// 0x20du16, 0x20cu16, 0x20bu16, 0x20au16,
2272+
/// 0x209u16, 0x208u16, 0x207u16, 0x206u16,
22832273
/// ]);
22842274
/// assert_eq!(
22852275
/// IpAddr::V6(Ipv6Addr::new(
2286-
/// 0x20d, 0x20c,
2287-
/// 0x20b, 0x20a,
2288-
/// 0x209, 0x208,
2289-
/// 0x207, 0x206
2276+
/// 0x20d, 0x20c, 0x20b, 0x20a,
2277+
/// 0x209, 0x208, 0x207, 0x206,
22902278
/// )),
22912279
/// addr
22922280
/// );

0 commit comments

Comments
 (0)