about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2018-08-12 23:27:04 +0200
committerGitHub <noreply@github.com>2018-08-12 23:27:04 +0200
commitf618071c46064c0cb6a9a367eb5c9d9a7607c395 (patch)
tree7d68bf70fa54338501ac9578305d7eb2f0a5bac0 /src/liballoc
parent34956ac0f686afd81d37310ab96e1d028007f679 (diff)
parentec18991492849393a8b3ae4e0c70a22319e8ea60 (diff)
downloadrust-f618071c46064c0cb6a9a367eb5c9d9a7607c395.tar.gz
rust-f618071c46064c0cb6a9a367eb5c9d9a7607c395.zip
Rollup merge of #53273 - frewsxcv:frewsxcv-ufffd, r=GuillaumeGomez
Add links to std::char::REPLACEMENT_CHARACTER from docs.

There are a few places where we mention the replacement character in the
docs, and it could be helpful for users to utilize the constant which is
available in the standard library, so let’s link to it!
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/string.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs
index 631779a17a1..dd559df08cc 100644
--- a/src/liballoc/string.rs
+++ b/src/liballoc/string.rs
@@ -519,10 +519,11 @@ impl String {
     /// between the two. Not all byte slices are valid strings, however: strings
     /// are required to be valid UTF-8. During this conversion,
     /// `from_utf8_lossy()` will replace any invalid UTF-8 sequences with
-    /// `U+FFFD REPLACEMENT CHARACTER`, which looks like this: �
+    /// [`U+FFFD REPLACEMENT CHARACTER`][U+FFFD], which looks like this: �
     ///
     /// [`u8`]: ../../std/primitive.u8.html
     /// [byteslice]: ../../std/primitive.slice.html
+    /// [U+FFFD]: ../char/constant.REPLACEMENT_CHARACTER.html
     ///
     /// If you are sure that the byte slice is valid UTF-8, and you don't want
     /// to incur the overhead of the conversion, there is an unsafe version
@@ -621,7 +622,7 @@ impl String {
     }
 
     /// Decode a UTF-16 encoded slice `v` into a `String`, replacing
-    /// invalid data with the replacement character (U+FFFD).
+    /// invalid data with [the replacement character (`U+FFFD`)][U+FFFD].
     ///
     /// Unlike [`from_utf8_lossy`] which returns a [`Cow<'a, str>`],
     /// `from_utf16_lossy` returns a `String` since the UTF-16 to UTF-8
@@ -629,6 +630,7 @@ impl String {
     ///
     /// [`from_utf8_lossy`]: #method.from_utf8_lossy
     /// [`Cow<'a, str>`]: ../borrow/enum.Cow.html
+    /// [U+FFFD]: ../char/constant.REPLACEMENT_CHARACTER.html
     ///
     /// # Examples
     ///