Skip to content

Commit 725d37c

Browse files
committed
Make doctests of Ipv4Addr::from(u32) easier to read
1 parent 07f1fde commit 725d37c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

library/std/src/net/ip.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -982,8 +982,8 @@ impl From<Ipv4Addr> for u32 {
982982
/// ```
983983
/// use std::net::Ipv4Addr;
984984
///
985-
/// let addr = Ipv4Addr::new(13, 12, 11, 10);
986-
/// assert_eq!(0x0d0c0b0au32, u32::from(addr));
985+
/// let addr = Ipv4Addr::new(0xca, 0xfe, 0xba, 0xbe);
986+
/// assert_eq!(0xcafebabe, u32::from(addr));
987987
/// ```
988988
fn from(ip: Ipv4Addr) -> u32 {
989989
let ip = ip.octets();
@@ -1000,8 +1000,8 @@ impl From<u32> for Ipv4Addr {
10001000
/// ```
10011001
/// use std::net::Ipv4Addr;
10021002
///
1003-
/// let addr = Ipv4Addr::from(0x0d0c0b0au32);
1004-
/// assert_eq!(Ipv4Addr::new(13, 12, 11, 10), addr);
1003+
/// let addr = Ipv4Addr::from(0xcafebabe);
1004+
/// assert_eq!(Ipv4Addr::new(0xca, 0xfe, 0xba, 0xbe), addr);
10051005
/// ```
10061006
fn from(ip: u32) -> Ipv4Addr {
10071007
Ipv4Addr::from(ip.to_be_bytes())

0 commit comments

Comments
 (0)