]> git.lizzy.rs Git - rust.git/commitdiff
fix several issues in String docs
authorjordins <jordi.nistal@gmail.com>
Tue, 24 Sep 2019 13:25:24 +0000 (15:25 +0200)
committerjordins <jordi.nistal@gmail.com>
Tue, 24 Sep 2019 13:25:24 +0000 (15:25 +0200)
- In some places &str was shown instead of String.
- into_bytes is the reverse of from_utf8

Fixes #63797

src/liballoc/string.rs

index 1166e7b5df2959bb3d6d64af27e56b193a898045..e5f96ada6d5eee800aa40de213230d802e0663e5 100644 (file)
@@ -429,7 +429,7 @@ pub fn from_str(_: &str) -> String {
 
     /// Converts a vector of bytes to a `String`.
     ///
-    /// A string slice ([`&str`]) is made of bytes ([`u8`]), and a vector of bytes
+    /// A string ([`String`]) is made of bytes ([`u8`]), and a vector of bytes
     /// ([`Vec<u8>`]) is made of bytes, so this function converts between the
     /// two. Not all byte slices are valid `String`s, however: `String`
     /// requires that it is valid UTF-8. `from_utf8()` checks to ensure that
@@ -446,7 +446,7 @@ pub fn from_str(_: &str) -> String {
     /// If you need a [`&str`] instead of a `String`, consider
     /// [`str::from_utf8`].
     ///
-    /// The inverse of this method is [`as_bytes`].
+    /// The inverse of this method is [`into_bytes`].
     ///
     /// # Errors
     ///
@@ -480,11 +480,11 @@ pub fn from_str(_: &str) -> String {
     /// with this error.
     ///
     /// [`from_utf8_unchecked`]: struct.String.html#method.from_utf8_unchecked
-    /// [`&str`]: ../../std/primitive.str.html
+    /// [`String`]: struct.String.html
     /// [`u8`]: ../../std/primitive.u8.html
     /// [`Vec<u8>`]: ../../std/vec/struct.Vec.html
     /// [`str::from_utf8`]: ../../std/str/fn.from_utf8.html
-    /// [`as_bytes`]: struct.String.html#method.as_bytes
+    /// [`into_bytes`]: struct.String.html#method.into_bytes
     /// [`FromUtf8Error`]: struct.FromUtf8Error.html
     /// [`Err`]: ../../std/result/enum.Result.html#variant.Err
     #[inline]