about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2020-08-07 09:35:14 +0900
committerGitHub <noreply@github.com>2020-08-07 09:35:14 +0900
commitc9c7048038d3776815f0952dcb15a7290297f8f5 (patch)
tree6a211d92ac5a2c1fc2f6a8d7fd83812a0eab5e79
parent9d5bd597ac2a7b00a5337677d8da49b1f8f58bb0 (diff)
parent725d37cae0a175edb0c013b3de5b337ce5b5054d (diff)
downloadrust-c9c7048038d3776815f0952dcb15a7290297f8f5.tar.gz
rust-c9c7048038d3776815f0952dcb15a7290297f8f5.zip
Rollup merge of #75175 - lzutao:doctest-ipv4-fromu32, r=cuviper
Make doctests of Ipv4Addr::from(u32) easier to read

There are many zeroes in `0x0d0c0b0au32` which makes it hard to read.
-rw-r--r--library/std/src/net/ip.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/library/std/src/net/ip.rs b/library/std/src/net/ip.rs
index a0c0981ebf9..a19a1f7df8a 100644
--- a/library/std/src/net/ip.rs
+++ b/library/std/src/net/ip.rs
@@ -976,8 +976,8 @@ impl From<Ipv4Addr> for u32 {
     /// ```
     /// use std::net::Ipv4Addr;
     ///
-    /// let addr = Ipv4Addr::new(13, 12, 11, 10);
-    /// assert_eq!(0x0d0c0b0au32, u32::from(addr));
+    /// let addr = Ipv4Addr::new(0xca, 0xfe, 0xba, 0xbe);
+    /// assert_eq!(0xcafebabe, u32::from(addr));
     /// ```
     fn from(ip: Ipv4Addr) -> u32 {
         let ip = ip.octets();
@@ -994,8 +994,8 @@ impl From<u32> for Ipv4Addr {
     /// ```
     /// use std::net::Ipv4Addr;
     ///
-    /// let addr = Ipv4Addr::from(0x0d0c0b0au32);
-    /// assert_eq!(Ipv4Addr::new(13, 12, 11, 10), addr);
+    /// let addr = Ipv4Addr::from(0xcafebabe);
+    /// assert_eq!(Ipv4Addr::new(0xca, 0xfe, 0xba, 0xbe), addr);
     /// ```
     fn from(ip: u32) -> Ipv4Addr {
         Ipv4Addr::from(ip.to_be_bytes())