Skip to content

Commit 0b17448

Browse files
madsmtmdunmatt
authored andcommitted
Fix documentation links by using newly-ish stabilized "intra-doc links"
1 parent d7df856 commit 0b17448

File tree

5 files changed

+70
-131
lines changed

5 files changed

+70
-131
lines changed

Cargo.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ serde = { version = "^1", default-features = false, optional = true }
1818
serde_test = "^1"
1919

2020
[features]
21-
default = [ ]
22-
21+
std = []
2322
# Deprecated. Does nothing.
2423
i128 = [ ]

src/addr.rs

+23-30
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ use {IpAddr, Ipv4Addr, Ipv6Addr};
1212
/// as possibly some version-dependent additional information. See [`SocketAddrV4`]'s and
1313
/// [`SocketAddrV6`]'s respective documentation for more details.
1414
///
15-
/// [IP address]: ../../no-std-net/enum.IpAddr.html
16-
/// [`SocketAddrV4`]: ../../no-std-net/struct.SocketAddrV4.html
17-
/// [`SocketAddrV6`]: ../../no-std-net/struct.SocketAddrV6.html
15+
/// [IP address]: IpAddr
1816
///
1917
/// # Examples
2018
///
@@ -38,7 +36,7 @@ pub enum SocketAddr {
3836
impl SocketAddr {
3937
/// Creates a new socket address from an [IP address] and a port number.
4038
///
41-
/// [IP address]: ../../no-std-net/enum.IpAddr.html
39+
/// [IP address]: IpAddr
4240
///
4341
/// # Examples
4442
///
@@ -131,10 +129,8 @@ impl SocketAddr {
131129
/// Returns [`true`] if the [IP address] in this `SocketAddr` is an
132130
/// [IPv4 address], and [`false`] otherwise.
133131
///
134-
/// [`true`]: ../../std/primitive.bool.html
135-
/// [`false`]: ../../std/primitive.bool.html
136-
/// [IP address]: ../../no-std-net/enum.IpAddr.html
137-
/// [IPv4 address]: ../../no-std-net/enum.IpAddr.html#variant.V4
132+
/// [IP address]: IpAddr
133+
/// [`IPv4` address]: IpAddr::V4
138134
///
139135
/// # Examples
140136
///
@@ -157,10 +153,8 @@ impl SocketAddr {
157153
/// Returns [`true`] if the [IP address] in this `SocketAddr` is an
158154
/// [IPv6 address], and [`false`] otherwise.
159155
///
160-
/// [`true`]: ../../std/primitive.bool.html
161-
/// [`false`]: ../../std/primitive.bool.html
162-
/// [IP address]: ../../no-std-net/enum.IpAddr.html
163-
/// [IPv6 address]: ../../no-std-net/enum.IpAddr.html#variant.V6
156+
/// [IP address]: IpAddr
157+
/// [`IPv6` address]: IpAddr::V6
164158
///
165159
/// # Examples
166160
///
@@ -190,8 +184,7 @@ impl SocketAddr {
190184
/// See [`SocketAddr`] for a type encompassing both IPv4 and IPv6 socket addresses.
191185
///
192186
/// [IETF RFC 793]: https://tools.ietf.org/html/rfc793
193-
/// [IPv4 address]: ../../no-std-net/struct.Ipv4Addr.html
194-
/// [`SocketAddr`]: ../../no-std-net/enum.SocketAddr.html
187+
/// [`IPv4` address]: Ipv4Addr
195188
///
196189
/// # Examples
197190
///
@@ -213,7 +206,7 @@ pub struct SocketAddrV4 {
213206
impl SocketAddrV4 {
214207
/// Creates a new socket address from an [IPv4 address] and a port number.
215208
///
216-
/// [IPv4 address]: ../../no-std-net/struct.Ipv4Addr.html
209+
/// [`IPv4` address]: Ipv4Addr
217210
///
218211
/// # Examples
219212
///
@@ -297,8 +290,7 @@ impl SocketAddrV4 {
297290
/// See [`SocketAddr`] for a type encompassing both IPv4 and IPv6 socket addresses.
298291
///
299292
/// [IETF RFC 2553, Section 3.3]: https://tools.ietf.org/html/rfc2553#section-3.3
300-
/// [IPv6 address]: ../../no-std-net/struct.Ipv6Addr.html
301-
/// [`SocketAddr`]: ../../no-std-net/enum.SocketAddr.html
293+
/// [`IPv6` address]: Ipv6Addr
302294
///
303295
/// # Examples
304296
///
@@ -327,7 +319,7 @@ impl SocketAddrV6 {
327319
/// parameters, see [IETF RFC 2553, Section 3.3].
328320
///
329321
/// [IETF RFC 2553, Section 3.3]: https://tools.ietf.org/html/rfc2553#section-3.3
330-
/// [IPv6 address]: ../../no-std-net/struct.Ipv6Addr.html
322+
/// [`IPv6` address]: Ipv6Addr
331323
///
332324
/// # Examples
333325
///
@@ -568,18 +560,19 @@ impl ::fmt::Debug for SocketAddrV6 {
568560
/// Addresses returned by the operating system that are not IP addresses are
569561
/// silently ignored.
570562
///
571-
/// [`FromStr`]: ../../std/str/trait.FromStr.html
572-
/// [`IpAddr`]: ../../no-std-net/enum.IpAddr.html
573-
/// [`Ipv4Addr`]: ../../no-std-net/struct.Ipv4Addr.html
574-
/// [`Ipv6Addr`]: ../../no-std-net/struct.Ipv6Addr.html
575-
/// [`SocketAddr`]: ../../no-std-net/enum.SocketAddr.html
576-
/// [`SocketAddrV4`]: ../../no-std-net/struct.SocketAddrV4.html
577-
/// [`SocketAddrV6`]: ../../no-std-net/struct.SocketAddrV6.html
578-
/// [`&str`]: ../../std/primitive.str.html
579-
/// [`TcpStream`]: ../../no-std-net/struct.TcpStream.html
580-
/// [`to_socket_addrs`]: #tymethod.to_socket_addrs
581-
/// [`UdpSocket`]: ../../no-std-net/struct.UdpSocket.html
582-
/// [`u16`]: ../../std/primitive.u16.html
563+
/// [`FromStr`]: core::str::FromStr
564+
/// [`&str`]: str
565+
#[cfg_attr(feature = "std", doc = "[`TcpStream`]: std::net::TcpStream")]
566+
#[cfg_attr(
567+
not(feature = "std"),
568+
doc = "[`TcpStream`]: https://doc.rust-lang.org/std/net/struct.TcpStream.html"
569+
)]
570+
/// [`to_socket_addrs`]: ToSocketAddrs::to_socket_addrs
571+
#[cfg_attr(feature = "std", doc = "[`UdpSocket`]: std::net::UdpSocket")]
572+
#[cfg_attr(
573+
not(feature = "std"),
574+
doc = "[`UdpSocket`]: https://doc.rust-lang.org/std/net/struct.UdpSocket.html"
575+
)]
583576
///
584577
pub trait ToSocketAddrs {
585578
/// Returned iterator over socket addresses which this type may correspond to.

0 commit comments

Comments
 (0)