@@ -104,22 +104,17 @@ pub const fn identity<T>(x: T) -> T { x }
104
104
/// If you need to do a costly conversion it is better to implement [`From`] with type
105
105
/// `&T` or write a custom function.
106
106
///
107
- /// `AsRef` has the same signature as [`Borrow`], but `Borrow` is different in few aspects:
107
+ /// `AsRef` has the same signature as [`Borrow`], but [ `Borrow`] is different in few aspects:
108
108
///
109
- /// - Unlike `AsRef`, `Borrow` has a blanket impl for any `T`, and can be used to accept either
109
+ /// - Unlike `AsRef`, [ `Borrow`] has a blanket impl for any `T`, and can be used to accept either
110
110
/// a reference or a value.
111
- /// - `Borrow` also requires that `Hash`, `Eq` and `Ord` for borrowed value are
111
+ /// - [ `Borrow`] also requires that [ `Hash`], [ `Eq`] and [ `Ord`] for borrowed value are
112
112
/// equivalent to those of the owned value. For this reason, if you want to
113
- /// borrow only a single field of a struct you can implement `AsRef`, but not `Borrow`.
114
- ///
115
- /// [`Borrow`]: ../../std/borrow/trait.Borrow.html
113
+ /// borrow only a single field of a struct you can implement `AsRef`, but not [`Borrow`].
116
114
///
117
115
/// **Note: This trait must not fail**. If the conversion can fail, use a
118
116
/// dedicated method which returns an [`Option<T>`] or a [`Result<T, E>`].
119
117
///
120
- /// [`Option<T>`]: ../../std/option/enum.Option.html
121
- /// [`Result<T, E>`]: ../../std/result/enum.Result.html
122
- ///
123
118
/// # Generic Implementations
124
119
///
125
120
/// - `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 }
132
127
/// converted to the specified type `T`.
133
128
///
134
129
/// For example: By creating a generic function that takes an `AsRef<str>` we express that we
135
- /// want to accept all references that can be converted to `&str` as an argument.
136
- /// Since both [`String`] and `&str` implement `AsRef<str>` we can accept both as input argument.
130
+ /// want to accept all references that can be converted to [ `&str`] as an argument.
131
+ /// Since both [`String`] and [ `&str`] implement `AsRef<str>` we can accept both as input argument.
137
132
///
133
+ /// [`Option<T>`]: ../../std/option/enum.Option.html
134
+ /// [`Result<T, E>`]: ../../std/result/enum.Result.html
135
+ /// [`Borrow`]: ../../std/borrow/trait.Borrow.html
136
+ /// [`Hash`]: ../../std/hash/trait.Hash.html
137
+ /// [`Eq`]: ../../std/cmp/trait.Eq.html
138
+ /// [`Ord`]: ../../std/cmp/trait.Ord.html
139
+ /// [`&str`]: ../../std/primitive.str.html
138
140
/// [`String`]: ../../std/string/struct.String.html
139
141
///
140
142
/// ```
0 commit comments