Auto merge of #88343 - steffahn:fix_code_spacing, r=jyn514

Fix spacing of links in inline code.

Similar to #80733, but the focus is different. This PR eliminates all occurrences of pieced-together inline code blocks like [`Box`]`<`[`Option`]`<T>>` and replaces them with good-looking ones (using HTML-syntax), like <code>[Box]<[Option]\<T>></code>. As far as I can tell, I should’ve found all of these in the standard library (regex search with `` r"`\]`|`\[`" ``) \[except for in `core::convert` where I’ve noticed other things in the docs that I want to fix in a separate PR]. In particular, unlike #80733, I’ve added almost no new instance of inline code that’s broken up into multiple links (or some link and some link-free part). I also added tooltips (the stuff in quotes for the markdown link listings) in places that caught my eye, but that’s by no means systematic, just opportunistic.

[Box]: https://doc.rust-lang.org/std/boxed/struct.Box.html "Box"
[`Box`]: https://doc.rust-lang.org/std/boxed/struct.Box.html "Box"
[Option]: https://doc.rust-lang.org/std/option/enum.Option.html "Option"
[`Option`]: https://doc.rust-lang.org/std/option/enum.Option.html "Option"

Context: I got annoyed by repeatedly running into new misformatted inline code while reading the standard library docs. I know that once issue #83997 (and/or related ones) are resolved, these changes become somewhat obsolete, but I fail to notice much progress on that end right now.

r? `@jyn514`
This commit is contained in:
bors
2021-09-25 20:08:11 +00:00
26 changed files with 225 additions and 234 deletions

View File

@@ -765,15 +765,15 @@ impl hash::Hash for SocketAddrV6 {
///
/// * [`SocketAddr`]: [`to_socket_addrs`] is the identity function.
///
/// * [`SocketAddrV4`], [`SocketAddrV6`], `(`[`IpAddr`]`, `[`u16`]`)`,
/// `(`[`Ipv4Addr`]`, `[`u16`]`)`, `(`[`Ipv6Addr`]`, `[`u16`]`)`:
/// * [`SocketAddrV4`], [`SocketAddrV6`], <code>([IpAddr], [u16])</code>,
/// <code>([Ipv4Addr], [u16])</code>, <code>([Ipv6Addr], [u16])</code>:
/// [`to_socket_addrs`] constructs a [`SocketAddr`] trivially.
///
/// * `(`[`&str`]`, `[`u16`]`)`: [`&str`] should be either a string representation
/// * <code>(&[str], [u16])</code>: <code>&[str]</code> should be either a string representation
/// of an [`IpAddr`] address as expected by [`FromStr`] implementation or a host
/// name. [`u16`] is the port number.
///
/// * [`&str`]: the string should be either a string representation of a
/// * <code>&[str]</code>: the string should be either a string representation of a
/// [`SocketAddr`] as expected by its [`FromStr`] implementation or a string like
/// `<host_name>:<port>` pair where `<port>` is a [`u16`] value.
///
@@ -789,11 +789,10 @@ impl hash::Hash for SocketAddrV6 {
/// Addresses returned by the operating system that are not IP addresses are
/// silently ignored.
///
/// [`FromStr`]: crate::str::FromStr
/// [`&str`]: str
/// [`TcpStream`]: crate::net::TcpStream
/// [`FromStr`]: crate::str::FromStr "std::str::FromStr"
/// [`TcpStream`]: crate::net::TcpStream "net::TcpStream"
/// [`to_socket_addrs`]: ToSocketAddrs::to_socket_addrs
/// [`UdpSocket`]: crate::net::UdpSocket
/// [`UdpSocket`]: crate::net::UdpSocket "net::UdpSocket"
///
/// # Examples
///
@@ -872,7 +871,7 @@ pub trait ToSocketAddrs {
#[stable(feature = "rust1", since = "1.0.0")]
type Iter: Iterator<Item = SocketAddr>;
/// Converts this object to an iterator of resolved `SocketAddr`s.
/// Converts this object to an iterator of resolved [`SocketAddr`]s.
///
/// The returned iterator might not actually yield any values depending on the
/// outcome of any resolution performed.

View File

@@ -44,16 +44,16 @@ mod udp;
pub enum Shutdown {
/// The reading portion of the [`TcpStream`] should be shut down.
///
/// All currently blocked and future [reads] will return [`Ok`]`(0)`.
/// All currently blocked and future [reads] will return <code>[Ok]\(0)</code>.
///
/// [reads]: crate::io::Read
/// [reads]: crate::io::Read "io::Read"
#[stable(feature = "rust1", since = "1.0.0")]
Read,
/// The writing portion of the [`TcpStream`] should be shut down.
///
/// All currently blocked and future [writes] will return an error.
///
/// [writes]: crate::io::Write
/// [writes]: crate::io::Write "io::Write"
#[stable(feature = "rust1", since = "1.0.0")]
Write,
/// Both the reading and the writing portions of the [`TcpStream`] should be shut down.