Skip to content

Commit c31d315

Browse files
authored
Rollup merge of rust-lang#80720 - steffahn:prettify_prelude_imports, r=camelid,jyn514
Make documentation of which items the prelude exports more readable. I recently figured out that rustdoc allows link inside of inline code blocks as long as they’re delimited with `<code> </code>` instead of `` ` ` ``. I think this applies nicely in the listing of prelude exports [in the docs](https://doc.rust-lang.org/std/prelude/index.html). There, currently unformatted `::` and `{ , }` is used in order to mimick import syntax while attatching links to individual identifiers. ## Rendered Comparison ### Currently (light) ![Screenshot_20210105_155801](https://user-images.githubusercontent.com/3986214/103661510-1a87be80-4f6f-11eb-8360-1dfb23f732e8.png) ### After this PR (light) ![Screenshot_20210105_155811](https://user-images.githubusercontent.com/3986214/103661533-1f4c7280-4f6f-11eb-89d4-874793937824.png) ### Currently (dark) ![Screenshot_20210105_155824](https://user-images.githubusercontent.com/3986214/103661571-2a9f9e00-4f6f-11eb-95f9-e291b5570b41.png) ### After this PR (dark) ![Screenshot_20210105_155836](https://user-images.githubusercontent.com/3986214/103661592-2ffce880-4f6f-11eb-977a-82afcb07d331.png) ### Currently (ayu) ![Screenshot_20210105_155917](https://user-images.githubusercontent.com/3986214/103661619-39865080-4f6f-11eb-9ca1-9045a107cddd.png) ### After this PR (ayu) ![Screenshot_20210105_155923](https://user-images.githubusercontent.com/3986214/103661652-3db26e00-4f6f-11eb-82b7-378e38f0c41f.png) _Edit:_ I just noticed, the “current” screenshots are from stable, so there are a few more differences in the pictures than the ones from just this PR.
2 parents 698de8b + 6481bf7 commit c31d315

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

std/src/prelude/mod.rs

+32-32
Original file line numberDiff line numberDiff line change
@@ -28,53 +28,53 @@
2828
//! The current version of the prelude (version 1) lives in
2929
//! [`std::prelude::v1`], and re-exports the following:
3030
//!
31-
//! * [`std::marker`]::{[`Copy`], [`Send`], [`Sized`], [`Sync`], [`Unpin`]}:
31+
//! * <code>[std::marker]::{[Copy], [Send], [Sized], [Sync], [Unpin]}</code>,
3232
//! marker traits that indicate fundamental properties of types.
33-
//! * [`std::ops`]::{[`Drop`], [`Fn`], [`FnMut`], [`FnOnce`]}: various
33+
//! * <code>[std::ops]::{[Drop], [Fn], [FnMut], [FnOnce]}</code>, various
3434
//! operations for both destructors and overloading `()`.
35-
//! * [`std::mem`]::[`drop`][`mem::drop`]: a convenience function for explicitly
35+
//! * <code>[std::mem]::[drop][mem::drop]</code>, a convenience function for explicitly
3636
//! dropping a value.
37-
//! * [`std::boxed`]::[`Box`]: a way to allocate values on the heap.
38-
//! * [`std::borrow`]::[`ToOwned`]: the conversion trait that defines
37+
//! * <code>[std::boxed]::[Box]</code>, a way to allocate values on the heap.
38+
//! * <code>[std::borrow]::[ToOwned]</code>, the conversion trait that defines
3939
//! [`to_owned`], the generic method for creating an owned type from a
4040
//! borrowed type.
41-
//! * [`std::clone`]::[`Clone`]: the ubiquitous trait that defines
42-
//! [`clone`][`Clone::clone`], the method for producing a copy of a value.
43-
//! * [`std::cmp`]::{[`PartialEq`], [`PartialOrd`], [`Eq`], [`Ord`]}: the
41+
//! * <code>[std::clone]::[Clone]</code>, the ubiquitous trait that defines
42+
//! [`clone`][Clone::clone], the method for producing a copy of a value.
43+
//! * <code>[std::cmp]::{[PartialEq], [PartialOrd], [Eq], [Ord]}</code>, the
4444
//! comparison traits, which implement the comparison operators and are often
4545
//! seen in trait bounds.
46-
//! * [`std::convert`]::{[`AsRef`], [`AsMut`], [`Into`], [`From`]}: generic
46+
//! * <code>[std::convert]::{[AsRef], [AsMut], [Into], [From]}</code>, generic
4747
//! conversions, used by savvy API authors to create overloaded methods.
48-
//! * [`std::default`]::[`Default`], types that have default values.
49-
//! * [`std::iter`]::{[`Iterator`], [`Extend`], [`IntoIterator`],
50-
//! [`DoubleEndedIterator`], [`ExactSizeIterator`]}: iterators of various
48+
//! * <code>[std::default]::[Default]</code>, types that have default values.
49+
//! * <code>[std::iter]::{[Iterator], [Extend], [IntoIterator], [DoubleEndedIterator], [ExactSizeIterator]}</code>,
50+
//! iterators of various
5151
//! kinds.
52-
//! * [`std::option`]::[`Option`]::{[`self`][`Option`], [`Some`], [`None`]}, a
52+
//! * <code>[std::option]::[Option]::{[self][Option], [Some], [None]}</code>, a
5353
//! type which expresses the presence or absence of a value. This type is so
5454
//! commonly used, its variants are also exported.
55-
//! * [`std::result`]::[`Result`]::{[`self`][`Result`], [`Ok`], [`Err`]}: a type
55+
//! * <code>[std::result]::[Result]::{[self][Result], [Ok], [Err]}</code>, a type
5656
//! for functions that may succeed or fail. Like [`Option`], its variants are
5757
//! exported as well.
58-
//! * [`std::string`]::{[`String`], [`ToString`]}: heap-allocated strings.
59-
//! * [`std::vec`]::[`Vec`]: a growable, heap-allocated vector.
58+
//! * <code>[std::string]::{[String], [ToString]}</code>, heap-allocated strings.
59+
//! * <code>[std::vec]::[Vec]</code>, a growable, heap-allocated vector.
6060
//!
61-
//! [`mem::drop`]: crate::mem::drop
62-
//! [`std::borrow`]: crate::borrow
63-
//! [`std::boxed`]: crate::boxed
64-
//! [`std::clone`]: crate::clone
65-
//! [`std::cmp`]: crate::cmp
66-
//! [`std::convert`]: crate::convert
67-
//! [`std::default`]: crate::default
68-
//! [`std::iter`]: crate::iter
69-
//! [`std::marker`]: crate::marker
70-
//! [`std::mem`]: crate::mem
71-
//! [`std::ops`]: crate::ops
72-
//! [`std::option`]: crate::option
61+
//! [mem::drop]: crate::mem::drop
62+
//! [std::borrow]: crate::borrow
63+
//! [std::boxed]: crate::boxed
64+
//! [std::clone]: crate::clone
65+
//! [std::cmp]: crate::cmp
66+
//! [std::convert]: crate::convert
67+
//! [std::default]: crate::default
68+
//! [std::iter]: crate::iter
69+
//! [std::marker]: crate::marker
70+
//! [std::mem]: crate::mem
71+
//! [std::ops]: crate::ops
72+
//! [std::option]: crate::option
7373
//! [`std::prelude::v1`]: v1
74-
//! [`std::result`]: crate::result
75-
//! [`std::slice`]: crate::slice
76-
//! [`std::string`]: crate::string
77-
//! [`std::vec`]: mod@crate::vec
74+
//! [std::result]: crate::result
75+
//! [std::slice]: crate::slice
76+
//! [std::string]: crate::string
77+
//! [std::vec]: mod@crate::vec
7878
//! [`to_owned`]: crate::borrow::ToOwned::to_owned
7979
//! [book-closures]: ../../book/ch13-01-closures.html
8080
//! [book-dtor]: ../../book/ch15-03-drop.html

0 commit comments

Comments
 (0)