@@ -318,8 +318,10 @@ impl str {
318
318
319
319
/// Returns a subslice of `str`.
320
320
///
321
- /// This is the non-panicking alternative to indexing the `str`. Returns `None` whenever
322
- /// equivalent indexing operation would panic.
321
+ /// This is the non-panicking alternative to indexing the `str`. Returns
322
+ /// [`None`] whenever equivalent indexing operation would panic.
323
+ ///
324
+ /// [`None`]: option/enum.Option.html#variant.None
323
325
///
324
326
/// # Examples
325
327
///
@@ -339,8 +341,10 @@ impl str {
339
341
340
342
/// Returns a mutable subslice of `str`.
341
343
///
342
- /// This is the non-panicking alternative to indexing the `str`. Returns `None` whenever
343
- /// equivalent indexing operation would panic.
344
+ /// This is the non-panicking alternative to indexing the `str`. Returns
345
+ /// [`None`] whenever equivalent indexing operation would panic.
346
+ ///
347
+ /// [`None`]: option/enum.Option.html#variant.None
344
348
///
345
349
/// # Examples
346
350
///
@@ -563,7 +567,7 @@ impl str {
563
567
core_str:: StrExt :: split_at_mut ( self , mid)
564
568
}
565
569
566
- /// Returns an iterator over the `char`s of a string slice.
570
+ /// Returns an iterator over the [ `char`] s of a string slice.
567
571
///
568
572
/// As a string slice consists of valid UTF-8, we can iterate through a
569
573
/// string slice by [`char`]. This method returns such an iterator.
@@ -1650,13 +1654,13 @@ impl str {
1650
1654
1651
1655
/// Parses this string slice into another type.
1652
1656
///
1653
- /// Because `parse() ` is so general, it can cause problems with type
1654
- /// inference. As such, `parse() ` is one of the few times you'll see
1657
+ /// Because `parse` is so general, it can cause problems with type
1658
+ /// inference. As such, `parse` is one of the few times you'll see
1655
1659
/// the syntax affectionately known as the 'turbofish': `::<>`. This
1656
1660
/// helps the inference algorithm understand specifically which type
1657
1661
/// you're trying to parse into.
1658
1662
///
1659
- /// `parse() ` can parse any type that implements the [`FromStr`] trait.
1663
+ /// `parse` can parse any type that implements the [`FromStr`] trait.
1660
1664
///
1661
1665
/// [`FromStr`]: str/trait.FromStr.html
1662
1666
///
@@ -1739,7 +1743,7 @@ impl str {
1739
1743
///
1740
1744
/// `replacen` creates a new [`String`], and copies the data from this string slice into it.
1741
1745
/// While doing so, it attempts to find matches of a pattern. If it finds any, it
1742
- /// replaces them with the replacement string slice at most `N ` times.
1746
+ /// replaces them with the replacement string slice at most `count ` times.
1743
1747
///
1744
1748
/// [`String`]: string/struct.String.html
1745
1749
///
@@ -1885,33 +1889,40 @@ impl str {
1885
1889
return s;
1886
1890
}
1887
1891
1888
- /// Escapes each char in `s` with `char::escape_debug`.
1892
+ /// Escapes each char in `s` with [`char::escape_debug`].
1893
+ ///
1894
+ /// [`char::escape_debug`]: primitive.char.html#method.escape_debug
1889
1895
#[ unstable( feature = "str_escape" ,
1890
1896
reason = "return type may change to be an iterator" ,
1891
1897
issue = "27791" ) ]
1892
1898
pub fn escape_debug ( & self ) -> String {
1893
1899
self . chars ( ) . flat_map ( |c| c. escape_debug ( ) ) . collect ( )
1894
1900
}
1895
1901
1896
- /// Escapes each char in `s` with `char::escape_default`.
1902
+ /// Escapes each char in `s` with [`char::escape_default`].
1903
+ ///
1904
+ /// [`char::escape_default`]: primitive.char.html#method.escape_default
1897
1905
#[ unstable( feature = "str_escape" ,
1898
1906
reason = "return type may change to be an iterator" ,
1899
1907
issue = "27791" ) ]
1900
1908
pub fn escape_default ( & self ) -> String {
1901
1909
self . chars ( ) . flat_map ( |c| c. escape_default ( ) ) . collect ( )
1902
1910
}
1903
1911
1904
- /// Escapes each char in `s` with `char::escape_unicode`.
1912
+ /// Escapes each char in `s` with [`char::escape_unicode`].
1913
+ ///
1914
+ /// [`char::escape_unicode`]: primitive.char.html#method.escape_unicode
1905
1915
#[ unstable( feature = "str_escape" ,
1906
1916
reason = "return type may change to be an iterator" ,
1907
1917
issue = "27791" ) ]
1908
1918
pub fn escape_unicode ( & self ) -> String {
1909
1919
self . chars ( ) . flat_map ( |c| c. escape_unicode ( ) ) . collect ( )
1910
1920
}
1911
1921
1912
- /// Converts a `Box<str>` into a [`String`] without copying or allocating.
1922
+ /// Converts a [ `Box<str>`] into a [`String`] without copying or allocating.
1913
1923
///
1914
1924
/// [`String`]: string/struct.String.html
1925
+ /// [`Box<str>`]: boxed/struct.Box.html
1915
1926
///
1916
1927
/// # Examples
1917
1928
///
0 commit comments