about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-08-30 23:08:04 +0200
committerGitHub <noreply@github.com>2019-08-30 23:08:04 +0200
commitac71a7f7cba1c0b543d1ebd928b6a175ce2049bb (patch)
tree71c916a72af5e4643b761e7cc4a3e00659b343a0 /src/libcore
parent5f07ff70870bc976ffdc691f75cf5a710f940c60 (diff)
parent0e7424653e82187bd6b17bf90239247d92bb5753 (diff)
downloadrust-ac71a7f7cba1c0b543d1ebd928b6a175ce2049bb.tar.gz
rust-ac71a7f7cba1c0b543d1ebd928b6a175ce2049bb.zip
Rollup merge of #63999 - GuillaumeGomez:as-ref-missing-links, r=Mark-Simulacrum
Add missing links on AsRef trait

cc @rust-lang/docs
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/convert.rs24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/libcore/convert.rs b/src/libcore/convert.rs
index 641621f492b..402a7b2c95a 100644
--- a/src/libcore/convert.rs
+++ b/src/libcore/convert.rs
@@ -104,22 +104,17 @@ pub const fn identity<T>(x: T) -> T { x }
 /// If you need to do a costly conversion it is better to implement [`From`] with type
 /// `&T` or write a custom function.
 ///
-/// `AsRef` has the same signature as [`Borrow`], but `Borrow` is different in few aspects:
+/// `AsRef` has the same signature as [`Borrow`], but [`Borrow`] is different in few aspects:
 ///
-/// - Unlike `AsRef`, `Borrow` has a blanket impl for any `T`, and can be used to accept either
+/// - Unlike `AsRef`, [`Borrow`] has a blanket impl for any `T`, and can be used to accept either
 ///   a reference or a value.
-/// - `Borrow` also requires that `Hash`, `Eq` and `Ord` for borrowed value are
+/// - [`Borrow`] also requires that [`Hash`], [`Eq`] and [`Ord`] for borrowed value are
 ///   equivalent to those of the owned value. For this reason, if you want to
-///   borrow only a single field of a struct you can implement `AsRef`, but not `Borrow`.
-///
-/// [`Borrow`]: ../../std/borrow/trait.Borrow.html
+///   borrow only a single field of a struct you can implement `AsRef`, but not [`Borrow`].
 ///
 /// **Note: This trait must not fail**. If the conversion can fail, use a
 /// dedicated method which returns an [`Option<T>`] or a [`Result<T, E>`].
 ///
-/// [`Option<T>`]: ../../std/option/enum.Option.html
-/// [`Result<T, E>`]: ../../std/result/enum.Result.html
-///
 /// # Generic Implementations
 ///
 /// - `AsRef` auto-dereferences if the inner type is a reference or a mutable
@@ -132,9 +127,16 @@ pub const fn identity<T>(x: T) -> T { x }
 /// converted to the specified type `T`.
 ///
 /// For example: By creating a generic function that takes an `AsRef<str>` we express that we
-/// want to accept all references that can be converted to `&str` as an argument.
-/// Since both [`String`] and `&str` implement `AsRef<str>` we can accept both as input argument.
+/// want to accept all references that can be converted to [`&str`] as an argument.
+/// Since both [`String`] and [`&str`] implement `AsRef<str>` we can accept both as input argument.
 ///
+/// [`Option<T>`]: ../../std/option/enum.Option.html
+/// [`Result<T, E>`]: ../../std/result/enum.Result.html
+/// [`Borrow`]: ../../std/borrow/trait.Borrow.html
+/// [`Hash`]: ../../std/hash/trait.Hash.html
+/// [`Eq`]: ../../std/cmp/trait.Eq.html
+/// [`Ord`]: ../../std/cmp/trait.Ord.html
+/// [`&str`]: ../../std/primitive.str.html
 /// [`String`]: ../../std/string/struct.String.html
 ///
 /// ```