Skip to content

Commit 7234141

Browse files
committed
Fix documentation style inconsistencies
1 parent 126561c commit 7234141

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

Diff for: library/std/src/net/ip.rs

+26-26
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ impl Ipv4Addr {
319319
Ipv4Addr { inner: c::in_addr { s_addr: u32::from_ne_bytes([a, b, c, d]) } }
320320
}
321321

322-
/// An IPv4 address with the address pointing to localhost: 127.0.0.1.
322+
/// An IPv4 address with the address pointing to localhost: `127.0.0.1`
323323
///
324324
/// # Examples
325325
///
@@ -332,7 +332,7 @@ impl Ipv4Addr {
332332
#[stable(feature = "ip_constructors", since = "1.30.0")]
333333
pub const LOCALHOST: Self = Ipv4Addr::new(127, 0, 0, 1);
334334

335-
/// An IPv4 address representing an unspecified address: 0.0.0.0
335+
/// An IPv4 address representing an unspecified address: `0.0.0.0`
336336
///
337337
/// This corresponds to the constant `INADDR_ANY` in other languages.
338338
///
@@ -348,7 +348,7 @@ impl Ipv4Addr {
348348
#[stable(feature = "ip_constructors", since = "1.30.0")]
349349
pub const UNSPECIFIED: Self = Ipv4Addr::new(0, 0, 0, 0);
350350

351-
/// An IPv4 address representing the broadcast address: 255.255.255.255
351+
/// An IPv4 address representing the broadcast address: `255.255.255.255`
352352
///
353353
/// # Examples
354354
///
@@ -379,7 +379,7 @@ impl Ipv4Addr {
379379
self.inner.s_addr.to_ne_bytes()
380380
}
381381

382-
/// Returns [`true`] for the special 'unspecified' address (0.0.0.0).
382+
/// Returns [`true`] for the special 'unspecified' address (`0.0.0.0`).
383383
///
384384
/// This property is defined in _UNIX Network Programming, Second Edition_,
385385
/// W. Richard Stevens, p. 891; see also [ip7].
@@ -401,7 +401,7 @@ impl Ipv4Addr {
401401
self.inner.s_addr == 0
402402
}
403403

404-
/// Returns [`true`] if this is a loopback address (127.0.0.0/8).
404+
/// Returns [`true`] if this is a loopback address (`127.0.0.0/8`).
405405
///
406406
/// This property is defined by [IETF RFC 1122].
407407
///
@@ -426,9 +426,9 @@ impl Ipv4Addr {
426426
///
427427
/// The private address ranges are defined in [IETF RFC 1918] and include:
428428
///
429-
/// - 10.0.0.0/8
430-
/// - 172.16.0.0/12
431-
/// - 192.168.0.0/16
429+
/// - `10.0.0.0/8`
430+
/// - `172.16.0.0/12`
431+
/// - `192.168.0.0/16`
432432
///
433433
/// [IETF RFC 1918]: https://tools.ietf.org/html/rfc1918
434434
///
@@ -457,7 +457,7 @@ impl Ipv4Addr {
457457
}
458458
}
459459

460-
/// Returns [`true`] if the address is link-local (169.254.0.0/16).
460+
/// Returns [`true`] if the address is link-local (`169.254.0.0/16`).
461461
///
462462
/// This property is defined by [IETF RFC 3927].
463463
///
@@ -490,7 +490,7 @@ impl Ipv4Addr {
490490
/// - the broadcast address (see [`Ipv4Addr::is_broadcast()`])
491491
/// - addresses used for documentation (see [`Ipv4Addr::is_documentation()`])
492492
/// - the unspecified address (see [`Ipv4Addr::is_unspecified()`]), and the whole
493-
/// 0.0.0.0/8 block
493+
/// `0.0.0.0/8` block
494494
/// - addresses reserved for future protocols (see
495495
/// [`Ipv4Addr::is_ietf_protocol_assignment()`], except
496496
/// `192.0.0.9/32` and `192.0.0.10/32` which are globally routable
@@ -682,9 +682,9 @@ impl Ipv4Addr {
682682
self.octets()[0] & 240 == 240 && !self.is_broadcast()
683683
}
684684

685-
/// Returns [`true`] if this is a multicast address (224.0.0.0/4).
685+
/// Returns [`true`] if this is a multicast address (`224.0.0.0/4`).
686686
///
687-
/// Multicast addresses have a most significant octet between 224 and 239,
687+
/// Multicast addresses have a most significant octet between `224` and `239`,
688688
/// and is defined by [IETF RFC 5771].
689689
///
690690
/// [IETF RFC 5771]: https://tools.ietf.org/html/rfc5771
@@ -705,9 +705,9 @@ impl Ipv4Addr {
705705
self.octets()[0] >= 224 && self.octets()[0] <= 239
706706
}
707707

708-
/// Returns [`true`] if this is a broadcast address (255.255.255.255).
708+
/// Returns [`true`] if this is a broadcast address (`255.255.255.255`).
709709
///
710-
/// A broadcast address has all octets set to 255 as defined in [IETF RFC 919].
710+
/// A broadcast address has all octets set to `255` as defined in [IETF RFC 919].
711711
///
712712
/// [IETF RFC 919]: https://tools.ietf.org/html/rfc919
713713
///
@@ -730,9 +730,9 @@ impl Ipv4Addr {
730730
///
731731
/// This is defined in [IETF RFC 5737]:
732732
///
733-
/// - 192.0.2.0/24 (TEST-NET-1)
734-
/// - 198.51.100.0/24 (TEST-NET-2)
735-
/// - 203.0.113.0/24 (TEST-NET-3)
733+
/// - `192.0.2.0/24` (TEST-NET-1)
734+
/// - `198.51.100.0/24` (TEST-NET-2)
735+
/// - `203.0.113.0/24` (TEST-NET-3)
736736
///
737737
/// [IETF RFC 5737]: https://tools.ietf.org/html/rfc5737
738738
///
@@ -760,7 +760,7 @@ impl Ipv4Addr {
760760

761761
/// Converts this address to an IPv4-compatible [`IPv6` address].
762762
///
763-
/// a.b.c.d becomes ::a.b.c.d
763+
/// `a.b.c.d` becomes `::a.b.c.d`
764764
///
765765
/// This isn't typically the method you want; these addresses don't typically
766766
/// function on modern systems. Use `to_ipv6_mapped` instead.
@@ -774,7 +774,7 @@ impl Ipv4Addr {
774774
///
775775
/// assert_eq!(
776776
/// Ipv4Addr::new(192, 0, 2, 255).to_ipv6_compatible(),
777-
/// Ipv6Addr::new(0, 0, 0, 0, 0, 0, 49152, 767)
777+
/// Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0xc000, 0x2ff)
778778
/// );
779779
/// ```
780780
#[rustc_const_stable(feature = "const_ipv4", since = "1.50.0")]
@@ -789,7 +789,7 @@ impl Ipv4Addr {
789789

790790
/// Converts this address to an IPv4-mapped [`IPv6` address].
791791
///
792-
/// a.b.c.d becomes ::ffff:a.b.c.d
792+
/// `a.b.c.d` becomes `::ffff:a.b.c.d`
793793
///
794794
/// [`IPv6` address]: Ipv6Addr
795795
///
@@ -799,7 +799,7 @@ impl Ipv4Addr {
799799
/// use std::net::{Ipv4Addr, Ipv6Addr};
800800
///
801801
/// assert_eq!(Ipv4Addr::new(192, 0, 2, 255).to_ipv6_mapped(),
802-
/// Ipv6Addr::new(0, 0, 0, 0, 0, 65535, 49152, 767));
802+
/// Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0xc000, 0x2ff));
803803
/// ```
804804
#[rustc_const_stable(feature = "const_ipv4", since = "1.50.0")]
805805
#[stable(feature = "rust1", since = "1.0.0")]
@@ -1172,7 +1172,7 @@ impl Ipv6Addr {
11721172
]
11731173
}
11741174

1175-
/// Returns [`true`] for the special 'unspecified' address (::).
1175+
/// Returns [`true`] for the special 'unspecified' address (`::`).
11761176
///
11771177
/// This property is defined in [IETF RFC 4291].
11781178
///
@@ -1374,7 +1374,7 @@ impl Ipv6Addr {
13741374
(self.segments()[0] & 0xffc0) == 0xfe80
13751375
}
13761376

1377-
/// Returns [`true`] if this is a deprecated unicast site-local address (fec0::/10). The
1377+
/// Returns [`true`] if this is a deprecated unicast site-local address (`fec0::/10`). The
13781378
/// unicast site-local address format is defined in [RFC 4291 section 2.5.7] as:
13791379
///
13801380
/// ```no_rust
@@ -1403,7 +1403,7 @@ impl Ipv6Addr {
14031403
///
14041404
/// # Warning
14051405
///
1406-
/// As per [RFC 3879], the whole `FEC0::/10` prefix is
1406+
/// As per [RFC 3879], the whole `fec0::/10` prefix is
14071407
/// deprecated. New software must not support site-local
14081408
/// addresses.
14091409
///
@@ -1512,7 +1512,7 @@ impl Ipv6Addr {
15121512
}
15131513
}
15141514

1515-
/// Returns [`true`] if this is a multicast address (ff00::/8).
1515+
/// Returns [`true`] if this is a multicast address (`ff00::/8`).
15161516
///
15171517
/// This property is defined by [IETF RFC 4291].
15181518
///
@@ -1568,7 +1568,7 @@ impl Ipv6Addr {
15681568
/// Converts this address to an [`IPv4` address]. Returns [`None`] if this address is
15691569
/// neither IPv4-compatible or IPv4-mapped.
15701570
///
1571-
/// ::a.b.c.d and ::ffff:a.b.c.d become a.b.c.d
1571+
/// `::a.b.c.d` and `::ffff:a.b.c.d` become `a.b.c.d`
15721572
///
15731573
/// [`IPv4` address]: Ipv4Addr
15741574
///

0 commit comments

Comments
 (0)