From 91314e2d279374bb9eec79754b3480d359d7a412 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Fri, 17 Jul 2020 12:04:04 -0700 Subject: [PATCH 1/2] Use intra-doc links in BTreeSet docs --- src/liballoc/collections/btree/set.rs | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/liballoc/collections/btree/set.rs b/src/liballoc/collections/btree/set.rs index d8959966fe5ad..530cb0c91b8e3 100644 --- a/src/liballoc/collections/btree/set.rs +++ b/src/liballoc/collections/btree/set.rs @@ -22,7 +22,6 @@ use super::Recover; /// to any other item, as determined by the [`Ord`] trait, changes while it is in the set. This is /// normally only possible through [`Cell`], [`RefCell`], global state, I/O, or unsafe code. /// -/// [`BTreeMap`]: struct.BTreeMap.html /// [`Ord`]: ../../std/cmp/trait.Ord.html /// [`Cell`]: ../../std/cell/struct.Cell.html /// [`RefCell`]: ../../std/cell/struct.RefCell.html @@ -78,8 +77,7 @@ impl Clone for BTreeSet { /// This `struct` is created by the [`iter`] method on [`BTreeSet`]. /// See its documentation for more. /// -/// [`BTreeSet`]: struct.BTreeSet.html -/// [`iter`]: struct.BTreeSet.html#method.iter +/// [`iter`]: BTreeSet::iter #[stable(feature = "rust1", since = "1.0.0")] pub struct Iter<'a, T: 'a> { iter: Keys<'a, T, ()>, @@ -97,8 +95,7 @@ impl fmt::Debug for Iter<'_, T> { /// This `struct` is created by the [`into_iter`] method on [`BTreeSet`] /// (provided by the `IntoIterator` trait). See its documentation for more. /// -/// [`BTreeSet`]: struct.BTreeSet.html -/// [`into_iter`]: struct.BTreeSet.html#method.into_iter +/// [`into_iter`]: BTreeSet#method.into_iter #[stable(feature = "rust1", since = "1.0.0")] #[derive(Debug)] pub struct IntoIter { @@ -110,8 +107,7 @@ pub struct IntoIter { /// This `struct` is created by the [`range`] method on [`BTreeSet`]. /// See its documentation for more. /// -/// [`BTreeSet`]: struct.BTreeSet.html -/// [`range`]: struct.BTreeSet.html#method.range +/// [`range`]: BTreeSet::range #[derive(Debug)] #[stable(feature = "btree_range", since = "1.17.0")] pub struct Range<'a, T: 'a> { @@ -194,8 +190,7 @@ where /// This `struct` is created by the [`difference`] method on [`BTreeSet`]. /// See its documentation for more. /// -/// [`BTreeSet`]: struct.BTreeSet.html -/// [`difference`]: struct.BTreeSet.html#method.difference +/// [`difference`]: BTreeSet::difference #[stable(feature = "rust1", since = "1.0.0")] pub struct Difference<'a, T: 'a> { inner: DifferenceInner<'a, T>, @@ -227,8 +222,7 @@ impl fmt::Debug for Difference<'_, T> { /// This `struct` is created by the [`symmetric_difference`] method on /// [`BTreeSet`]. See its documentation for more. /// -/// [`BTreeSet`]: struct.BTreeSet.html -/// [`symmetric_difference`]: struct.BTreeSet.html#method.symmetric_difference +/// [`symmetric_difference`]: BTreeSet::symmetric_difference #[stable(feature = "rust1", since = "1.0.0")] pub struct SymmetricDifference<'a, T: 'a>(MergeIterInner>); @@ -244,8 +238,7 @@ impl fmt::Debug for SymmetricDifference<'_, T> { /// This `struct` is created by the [`intersection`] method on [`BTreeSet`]. /// See its documentation for more. /// -/// [`BTreeSet`]: struct.BTreeSet.html -/// [`intersection`]: struct.BTreeSet.html#method.intersection +/// [`intersection`]: BTreeSet::intersection #[stable(feature = "rust1", since = "1.0.0")] pub struct Intersection<'a, T: 'a> { inner: IntersectionInner<'a, T>, @@ -277,8 +270,7 @@ impl fmt::Debug for Intersection<'_, T> { /// This `struct` is created by the [`union`] method on [`BTreeSet`]. /// See its documentation for more. /// -/// [`BTreeSet`]: struct.BTreeSet.html -/// [`union`]: struct.BTreeSet.html#method.union +/// [`union`]: BTreeSet::union #[stable(feature = "rust1", since = "1.0.0")] pub struct Union<'a, T: 'a>(MergeIterInner>); From 748634e151696a15875299e7b8307868080cd94c Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Fri, 17 Jul 2020 12:44:44 -0700 Subject: [PATCH 2/2] Use intra doc links in std::str --- src/libcore/str/mod.rs | 226 +++++++++++++---------------------------- 1 file changed, 73 insertions(+), 153 deletions(-) diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 86e8d5c42b7ad..faf58cafbb70b 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -31,9 +31,8 @@ pub mod lossy; /// `FromStr`'s [`from_str`] method is often used implicitly, through /// [`str`]'s [`parse`] method. See [`parse`]'s documentation for examples. /// -/// [`from_str`]: #tymethod.from_str -/// [`str`]: ../../std/primitive.str.html -/// [`parse`]: ../../std/primitive.str.html#method.parse +/// [`from_str`]: FromStr::from_str +/// [`parse`]: str::parse /// /// `FromStr` does not have a lifetime parameter, and so you can only parse types /// that do not contain a lifetime parameter themselves. In other words, you can @@ -143,7 +142,7 @@ impl FromStr for bool { /// An error returned when parsing a `bool` using [`from_str`] fails /// -/// [`from_str`]: ../../std/primitive.bool.html#method.from_str +/// [`from_str`]: FromStr::from_str #[derive(Debug, Clone, PartialEq, Eq)] #[stable(feature = "rust1", since = "1.0.0")] pub struct ParseBoolError { @@ -266,8 +265,7 @@ impl Utf8Error { /// that it is valid UTF-8. `from_utf8()` checks to ensure that the bytes are valid /// UTF-8, and then does the conversion. /// -/// [`&str`]: ../../std/primitive.str.html -/// [`u8`]: ../../std/primitive.u8.html +/// [`&str`]: str /// [byteslice]: ../../std/primitive.slice.html /// /// If you are sure that the byte slice is valid UTF-8, and you don't want to @@ -398,7 +396,7 @@ pub fn from_utf8_mut(v: &mut [u8]) -> Result<&mut str, Utf8Error> { /// it are valid UTF-8. If this constraint is violated, undefined behavior /// results, as the rest of Rust assumes that [`&str`]s are valid UTF-8. /// -/// [`&str`]: ../../std/primitive.str.html +/// [`&str`]: str /// /// # Examples /// @@ -429,9 +427,7 @@ pub unsafe fn from_utf8_unchecked(v: &[u8]) -> &str { /// Converts a slice of bytes to a string slice without checking /// that the string contains valid UTF-8; mutable version. /// -/// See the immutable version, [`from_utf8_unchecked()`][fromutf8], for more information. -/// -/// [fromutf8]: fn.from_utf8_unchecked.html +/// See the immutable version, [`from_utf8_unchecked()`] for more information. /// /// # Examples /// @@ -476,13 +472,11 @@ Section: Iterators /// An iterator over the [`char`]s of a string slice. /// -/// [`char`]: ../../std/primitive.char.html /// /// This struct is created by the [`chars`] method on [`str`]. /// See its documentation for more. /// -/// [`chars`]: ../../std/primitive.str.html#method.chars -/// [`str`]: ../../std/primitive.str.html +/// [`chars`]: str::chars #[derive(Clone)] #[stable(feature = "rust1", since = "1.0.0")] pub struct Chars<'a> { @@ -676,13 +670,10 @@ impl<'a> Chars<'a> { /// An iterator over the [`char`]s of a string slice, and their positions. /// -/// [`char`]: ../../std/primitive.char.html -/// /// This struct is created by the [`char_indices`] method on [`str`]. /// See its documentation for more. /// -/// [`char_indices`]: ../../std/primitive.str.html#method.char_indices -/// [`str`]: ../../std/primitive.str.html +/// [`char_indices`]: str::char_indices #[derive(Clone, Debug)] #[stable(feature = "rust1", since = "1.0.0")] pub struct CharIndices<'a> { @@ -756,8 +747,7 @@ impl<'a> CharIndices<'a> { /// This struct is created by the [`bytes`] method on [`str`]. /// See its documentation for more. /// -/// [`bytes`]: ../../std/primitive.str.html#method.bytes -/// [`str`]: ../../std/primitive.str.html +/// [`bytes`]: str::bytes #[stable(feature = "rust1", since = "1.0.0")] #[derive(Clone, Debug)] pub struct Bytes<'a>(Copied>); @@ -1249,12 +1239,12 @@ generate_pattern_iterators! { forward: /// Created with the method [`split`]. /// - /// [`split`]: ../../std/primitive.str.html#method.split + /// [`split`]: str::split struct Split; reverse: /// Created with the method [`rsplit`]. /// - /// [`rsplit`]: ../../std/primitive.str.html#method.rsplit + /// [`rsplit`]: str::rsplit struct RSplit; stability: #[stable(feature = "rust1", since = "1.0.0")] @@ -1267,12 +1257,12 @@ generate_pattern_iterators! { forward: /// Created with the method [`split_terminator`]. /// - /// [`split_terminator`]: ../../std/primitive.str.html#method.split_terminator + /// [`split_terminator`]: str::split_terminator struct SplitTerminator; reverse: /// Created with the method [`rsplit_terminator`]. /// - /// [`rsplit_terminator`]: ../../std/primitive.str.html#method.rsplit_terminator + /// [`rsplit_terminator`]: str::rsplit_terminator struct RSplitTerminator; stability: #[stable(feature = "rust1", since = "1.0.0")] @@ -1343,12 +1333,12 @@ generate_pattern_iterators! { forward: /// Created with the method [`splitn`]. /// - /// [`splitn`]: ../../std/primitive.str.html#method.splitn + /// [`splitn`]: str::splitn struct SplitN; reverse: /// Created with the method [`rsplitn`]. /// - /// [`rsplitn`]: ../../std/primitive.str.html#method.rsplitn + /// [`rsplitn`]: str::rsplitn struct RSplitN; stability: #[stable(feature = "rust1", since = "1.0.0")] @@ -1398,12 +1388,12 @@ generate_pattern_iterators! { forward: /// Created with the method [`match_indices`]. /// - /// [`match_indices`]: ../../std/primitive.str.html#method.match_indices + /// [`match_indices`]: str::match_indices struct MatchIndices; reverse: /// Created with the method [`rmatch_indices`]. /// - /// [`rmatch_indices`]: ../../std/primitive.str.html#method.rmatch_indices + /// [`rmatch_indices`]: str::rmatch_indices struct RMatchIndices; stability: #[stable(feature = "str_match_indices", since = "1.5.0")] @@ -1455,12 +1445,12 @@ generate_pattern_iterators! { forward: /// Created with the method [`matches`]. /// - /// [`matches`]: ../../std/primitive.str.html#method.matches + /// [`matches`]: str::matches struct Matches; reverse: /// Created with the method [`rmatches`]. /// - /// [`rmatches`]: ../../std/primitive.str.html#method.rmatches + /// [`rmatches`]: str::rmatches struct RMatches; stability: #[stable(feature = "str_matches", since = "1.2.0")] @@ -1474,8 +1464,7 @@ generate_pattern_iterators! { /// This struct is created with the [`lines`] method on [`str`]. /// See its documentation for more. /// -/// [`lines`]: ../../std/primitive.str.html#method.lines -/// [`str`]: ../../std/primitive.str.html +/// [`lines`]: str::lines #[stable(feature = "rust1", since = "1.0.0")] #[derive(Clone, Debug)] pub struct Lines<'a>(Map, LinesAnyMap>); @@ -1513,7 +1502,7 @@ impl FusedIterator for Lines<'_> {} /// Created with the method [`lines_any`]. /// -/// [`lines_any`]: ../../std/primitive.str.html#method.lines_any +/// [`lines_any`]: str::lines_any #[stable(feature = "rust1", since = "1.0.0")] #[rustc_deprecated(since = "1.4.0", reason = "use lines()/Lines instead now")] #[derive(Clone, Debug)] @@ -2347,9 +2336,7 @@ impl str { } /// Converts a string slice to a byte slice. To convert the byte slice back - /// into a string slice, use the [`str::from_utf8`] function. - /// - /// [`str::from_utf8`]: ./str/fn.from_utf8.html + /// into a string slice, use the [`from_utf8`] function. /// /// # Examples /// @@ -2429,8 +2416,7 @@ impl str { /// The caller must ensure that the returned pointer is never written to. /// If you need to mutate the contents of the string slice, use [`as_mut_ptr`]. /// - /// [`u8`]: primitive.u8.html - /// [`as_mut_ptr`]: #method.as_mut_ptr + /// [`as_mut_ptr`]: str::as_mut_ptr /// /// # Examples /// @@ -2455,8 +2441,6 @@ impl str { /// /// It is your responsibility to make sure that the string slice only gets /// modified in a way that it remains valid UTF-8. - /// - /// [`u8`]: primitive.u8.html #[stable(feature = "str_as_mut_ptr", since = "1.36.0")] #[inline] pub fn as_mut_ptr(&mut self) -> *mut u8 { @@ -2468,8 +2452,6 @@ impl str { /// This is the non-panicking alternative to indexing the `str`. Returns /// [`None`] whenever equivalent indexing operation would panic. /// - /// [`None`]: option/enum.Option.html#variant.None - /// /// # Examples /// /// ``` @@ -2495,8 +2477,6 @@ impl str { /// This is the non-panicking alternative to indexing the `str`. Returns /// [`None`] whenever equivalent indexing operation would panic. /// - /// [`None`]: option/enum.Option.html#variant.None - /// /// # Examples /// /// ``` @@ -2600,8 +2580,7 @@ impl str { /// This is generally not recommended, use with caution! For a safe /// alternative see [`str`] and [`Index`]. /// - /// [`str`]: primitive.str.html - /// [`Index`]: ops/trait.Index.html + /// [`Index`]: crate::ops::Index /// /// This new slice goes from `begin` to `end`, including `begin` but /// excluding `end`. @@ -2609,7 +2588,7 @@ impl str { /// To get a mutable string slice instead, see the /// [`slice_mut_unchecked`] method. /// - /// [`slice_mut_unchecked`]: #method.slice_mut_unchecked + /// [`slice_mut_unchecked`]: str::slice_mut_unchecked /// /// # Safety /// @@ -2652,8 +2631,7 @@ impl str { /// This is generally not recommended, use with caution! For a safe /// alternative see [`str`] and [`IndexMut`]. /// - /// [`str`]: primitive.str.html - /// [`IndexMut`]: ops/trait.IndexMut.html + /// [`IndexMut`]: crate::ops::IndexMut /// /// This new slice goes from `begin` to `end`, including `begin` but /// excluding `end`. @@ -2661,7 +2639,7 @@ impl str { /// To get an immutable string slice instead, see the /// [`slice_unchecked`] method. /// - /// [`slice_unchecked`]: #method.slice_unchecked + /// [`slice_unchecked`]: str::slice_unchecked /// /// # Safety /// @@ -2692,7 +2670,7 @@ impl str { /// To get mutable string slices instead, see the [`split_at_mut`] /// method. /// - /// [`split_at_mut`]: #method.split_at_mut + /// [`split_at_mut`]: str::split_at_mut /// /// # Panics /// @@ -2733,7 +2711,7 @@ impl str { /// /// To get immutable string slices instead, see the [`split_at`] method. /// - /// [`split_at`]: #method.split_at + /// [`split_at`]: str::split_at /// /// # Panics /// @@ -2913,7 +2891,7 @@ impl str { /// Core Property `White_Space`. If you only want to split on ASCII whitespace /// instead, use [`split_ascii_whitespace`]. /// - /// [`split_ascii_whitespace`]: #method.split_ascii_whitespace + /// [`split_ascii_whitespace`]: str::split_ascii_whitespace /// /// # Examples /// @@ -2954,7 +2932,7 @@ impl str { /// /// To split by Unicode `Whitespace` instead, use [`split_whitespace`]. /// - /// [`split_whitespace`]: #method.split_whitespace + /// [`split_whitespace`]: str::split_whitespace /// /// # Examples /// @@ -3068,8 +3046,7 @@ impl str { /// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a /// function or closure that determines if a character matches. /// - /// [`char`]: primitive.char.html - /// [pattern]: str/pattern/index.html + /// [pattern]: self::pattern /// /// # Examples /// @@ -3095,8 +3072,7 @@ impl str { /// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a /// function or closure that determines if a character matches. /// - /// [`char`]: primitive.char.html - /// [pattern]: str/pattern/index.html + /// [pattern]: self::pattern /// /// # Examples /// @@ -3121,8 +3097,7 @@ impl str { /// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a /// function or closure that determines if a character matches. /// - /// [`char`]: primitive.char.html - /// [pattern]: str/pattern/index.html + /// [pattern]: self::pattern /// /// # Examples /// @@ -3150,9 +3125,7 @@ impl str { /// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a /// function or closure that determines if a character matches. /// - /// [`None`]: option/enum.Option.html#variant.None - /// [`char`]: primitive.char.html - /// [pattern]: str/pattern/index.html + /// [pattern]: self::pattern /// /// # Examples /// @@ -3199,9 +3172,7 @@ impl str { /// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a /// function or closure that determines if a character matches. /// - /// [`None`]: option/enum.Option.html#variant.None - /// [`char`]: primitive.char.html - /// [pattern]: str/pattern/index.html + /// [pattern]: self::pattern /// /// # Examples /// @@ -3247,8 +3218,7 @@ impl str { /// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a /// function or closure that determines if a character matches. /// - /// [`char`]: primitive.char.html - /// [pattern]: str/pattern/index.html + /// [pattern]: self::pattern /// /// # Iterator behavior /// @@ -3256,12 +3226,10 @@ impl str { /// allows a reverse search and forward/reverse search yields the same /// elements. This is true for, e.g., [`char`], but not for `&str`. /// - /// [`DoubleEndedIterator`]: iter/trait.DoubleEndedIterator.html - /// /// If the pattern allows a reverse search but its results might differ /// from a forward search, the [`rsplit`] method can be used. /// - /// [`rsplit`]: #method.rsplit + /// [`rsplit`]: str::rsplit /// /// # Examples /// @@ -3348,7 +3316,7 @@ impl str { /// /// Use [`split_whitespace`] for this behavior. /// - /// [`split_whitespace`]: #method.split_whitespace + /// [`split_whitespace`]: str::split_whitespace #[stable(feature = "rust1", since = "1.0.0")] #[inline] pub fn split<'a, P: Pattern<'a>>(&'a self, pat: P) -> Split<'a, P> { @@ -3369,8 +3337,7 @@ impl str { /// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a /// function or closure that determines if a character matches. /// - /// [`char`]: primitive.char.html - /// [pattern]: str/pattern/index.html + /// [pattern]: self::pattern /// /// # Examples /// @@ -3409,8 +3376,7 @@ impl str { /// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a /// function or closure that determines if a character matches. /// - /// [`char`]: primitive.char.html - /// [pattern]: str/pattern/index.html + /// [pattern]: self::pattern /// /// # Iterator behavior /// @@ -3418,11 +3384,9 @@ impl str { /// search, and it will be a [`DoubleEndedIterator`] if a forward/reverse /// search yields the same elements. /// - /// [`DoubleEndedIterator`]: iter/trait.DoubleEndedIterator.html - /// /// For iterating from the front, the [`split`] method can be used. /// - /// [`split`]: #method.split + /// [`split`]: str::split /// /// # Examples /// @@ -3463,13 +3427,12 @@ impl str { /// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a /// function or closure that determines if a character matches. /// - /// [`char`]: primitive.char.html - /// [pattern]: str/pattern/index.html + /// [pattern]: self::pattern /// /// Equivalent to [`split`], except that the trailing substring /// is skipped if empty. /// - /// [`split`]: #method.split + /// [`split`]: str::split /// /// This method can be used for string data that is _terminated_, /// rather than _separated_ by a pattern. @@ -3480,12 +3443,10 @@ impl str { /// allows a reverse search and forward/reverse search yields the same /// elements. This is true for, e.g., [`char`], but not for `&str`. /// - /// [`DoubleEndedIterator`]: iter/trait.DoubleEndedIterator.html - /// /// If the pattern allows a reverse search but its results might differ /// from a forward search, the [`rsplit_terminator`] method can be used. /// - /// [`rsplit_terminator`]: #method.rsplit_terminator + /// [`rsplit_terminator`]: str::rsplit_terminator /// /// # Examples /// @@ -3510,13 +3471,12 @@ impl str { /// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a /// function or closure that determines if a character matches. /// - /// [`char`]: primitive.char.html - /// [pattern]: str/pattern/index.html + /// [pattern]: self::pattern /// /// Equivalent to [`split`], except that the trailing substring is /// skipped if empty. /// - /// [`split`]: #method.split + /// [`split`]: str::split /// /// This method can be used for string data that is _terminated_, /// rather than _separated_ by a pattern. @@ -3530,7 +3490,7 @@ impl str { /// For iterating from the front, the [`split_terminator`] method can be /// used. /// - /// [`split_terminator`]: #method.split_terminator + /// [`split_terminator`]: str::split_terminator /// /// # Examples /// @@ -3559,8 +3519,7 @@ impl str { /// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a /// function or closure that determines if a character matches. /// - /// [`char`]: primitive.char.html - /// [pattern]: str/pattern/index.html + /// [pattern]: self::pattern /// /// # Iterator behavior /// @@ -3570,7 +3529,7 @@ impl str { /// If the pattern allows a reverse search, the [`rsplitn`] method can be /// used. /// - /// [`rsplitn`]: #method.rsplitn + /// [`rsplitn`]: str::rsplitn /// /// # Examples /// @@ -3612,8 +3571,7 @@ impl str { /// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a /// function or closure that determines if a character matches. /// - /// [`char`]: primitive.char.html - /// [pattern]: str/pattern/index.html + /// [pattern]: self::pattern /// /// # Iterator behavior /// @@ -3622,7 +3580,7 @@ impl str { /// /// For splitting from the front, the [`splitn`] method can be used. /// - /// [`splitn`]: #method.splitn + /// [`splitn`]: str::splitn /// /// # Examples /// @@ -3660,8 +3618,7 @@ impl str { /// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a /// function or closure that determines if a character matches. /// - /// [`char`]: primitive.char.html - /// [pattern]: str/pattern/index.html + /// [pattern]: self::pattern /// /// # Iterator behavior /// @@ -3669,12 +3626,10 @@ impl str { /// allows a reverse search and forward/reverse search yields the same /// elements. This is true for, e.g., [`char`], but not for `&str`. /// - /// [`DoubleEndedIterator`]: iter/trait.DoubleEndedIterator.html - /// /// If the pattern allows a reverse search but its results might differ /// from a forward search, the [`rmatches`] method can be used. /// - /// [`rmatches`]: #method.rmatches + /// [`rmatches`]: str::matches /// /// # Examples /// @@ -3699,8 +3654,7 @@ impl str { /// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a /// function or closure that determines if a character matches. /// - /// [`char`]: primitive.char.html - /// [pattern]: str/pattern/index.html + /// [pattern]: self::pattern /// /// # Iterator behavior /// @@ -3708,11 +3662,9 @@ impl str { /// search, and it will be a [`DoubleEndedIterator`] if a forward/reverse /// search yields the same elements. /// - /// [`DoubleEndedIterator`]: iter/trait.DoubleEndedIterator.html - /// /// For iterating from the front, the [`matches`] method can be used. /// - /// [`matches`]: #method.matches + /// [`matches`]: str::matches /// /// # Examples /// @@ -3743,8 +3695,7 @@ impl str { /// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a /// function or closure that determines if a character matches. /// - /// [`char`]: primitive.char.html - /// [pattern]: str/pattern/index.html + /// [pattern]: self::pattern /// /// # Iterator behavior /// @@ -3752,12 +3703,10 @@ impl str { /// allows a reverse search and forward/reverse search yields the same /// elements. This is true for, e.g., [`char`], but not for `&str`. /// - /// [`DoubleEndedIterator`]: iter/trait.DoubleEndedIterator.html - /// /// If the pattern allows a reverse search but its results might differ /// from a forward search, the [`rmatch_indices`] method can be used. /// - /// [`rmatch_indices`]: #method.rmatch_indices + /// [`rmatch_indices`]: str::match_indices /// /// # Examples /// @@ -3788,8 +3737,7 @@ impl str { /// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a /// function or closure that determines if a character matches. /// - /// [`char`]: primitive.char.html - /// [pattern]: str/pattern/index.html + /// [pattern]: self::pattern /// /// # Iterator behavior /// @@ -3797,11 +3745,9 @@ impl str { /// search, and it will be a [`DoubleEndedIterator`] if a forward/reverse /// search yields the same elements. /// - /// [`DoubleEndedIterator`]: iter/trait.DoubleEndedIterator.html - /// /// For iterating from the front, the [`match_indices`] method can be used. /// - /// [`match_indices`]: #method.match_indices + /// [`match_indices`]: str::match_indices /// /// # Examples /// @@ -4009,8 +3955,7 @@ impl str { /// The [pattern] can be a [`char`], a slice of [`char`]s, or a function /// or closure that determines if a character matches. /// - /// [`char`]: primitive.char.html - /// [pattern]: str/pattern/index.html + /// [pattern]: self::pattern /// /// # Examples /// @@ -4057,8 +4002,7 @@ impl str { /// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a /// function or closure that determines if a character matches. /// - /// [`char`]: primitive.char.html - /// [pattern]: str/pattern/index.html + /// [pattern]: self::pattern /// /// # Text directionality /// @@ -4102,8 +4046,7 @@ impl str { /// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a /// function or closure that determines if a character matches. /// - /// [`char`]: primitive.char.html - /// [pattern]: str/pattern/index.html + /// [pattern]: self::pattern /// /// # Examples /// @@ -4130,8 +4073,7 @@ impl str { /// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a /// function or closure that determines if a character matches. /// - /// [`char`]: primitive.char.html - /// [pattern]: str/pattern/index.html + /// [pattern]: self::pattern /// /// # Examples /// @@ -4157,8 +4099,7 @@ impl str { /// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a /// function or closure that determines if a character matches. /// - /// [`char`]: primitive.char.html - /// [pattern]: str/pattern/index.html + /// [pattern]: self::pattern /// /// # Text directionality /// @@ -4206,8 +4147,7 @@ impl str { /// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a /// function or closure that determines if a character matches. /// - /// [`char`]: primitive.char.html - /// [pattern]: str/pattern/index.html + /// [pattern]: self::pattern /// /// # Text directionality /// @@ -4243,8 +4183,7 @@ impl str { /// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a /// function or closure that determines if a character matches. /// - /// [`char`]: primitive.char.html - /// [pattern]: str/pattern/index.html + /// [pattern]: self::pattern /// /// # Text directionality /// @@ -4292,15 +4231,14 @@ impl str { /// you're trying to parse into. /// /// `parse` can parse any type that implements the [`FromStr`] trait. - /// - /// [`FromStr`]: str/trait.FromStr.html + /// /// # Errors /// /// Will return [`Err`] if it's not possible to parse this string slice into /// the desired type. /// - /// [`Err`]: str/trait.FromStr.html#associatedtype.Err + /// [`Err`]: FromStr::Err /// /// # Examples /// @@ -4428,8 +4366,6 @@ impl str { /// Note: only extended grapheme codepoints that begin the string will be /// escaped. /// - /// [`char::escape_debug`]: ../std/primitive.char.html#method.escape_debug - /// /// # Examples /// /// As an iterator: @@ -4474,8 +4410,6 @@ impl str { /// Return an iterator that escapes each char in `self` with [`char::escape_default`]. /// - /// [`char::escape_default`]: ../std/primitive.char.html#method.escape_default - /// /// # Examples /// /// As an iterator: @@ -4512,8 +4446,6 @@ impl str { /// Return an iterator that escapes each char in `self` with [`char::escape_unicode`]. /// - /// [`char::escape_unicode`]: ../std/primitive.char.html#method.escape_unicode - /// /// # Examples /// /// As an iterator: @@ -4596,8 +4528,7 @@ impl Default for &mut str { /// This struct is created by the [`split_whitespace`] method on [`str`]. /// See its documentation for more. /// -/// [`split_whitespace`]: ../../std/primitive.str.html#method.split_whitespace -/// [`str`]: ../../std/primitive.str.html +/// [`split_whitespace`]: str::split_whitespace #[stable(feature = "split_whitespace", since = "1.1.0")] #[derive(Clone, Debug)] pub struct SplitWhitespace<'a> { @@ -4610,8 +4541,7 @@ pub struct SplitWhitespace<'a> { /// This struct is created by the [`split_ascii_whitespace`] method on [`str`]. /// See its documentation for more. /// -/// [`split_ascii_whitespace`]: ../../std/primitive.str.html#method.split_ascii_whitespace -/// [`str`]: ../../std/primitive.str.html +/// [`split_ascii_whitespace`]: str::split_ascii_whitespace #[stable(feature = "split_ascii_whitespace", since = "1.34.0")] #[derive(Clone, Debug)] pub struct SplitAsciiWhitespace<'a> { @@ -4626,8 +4556,7 @@ pub struct SplitAsciiWhitespace<'a> { /// This struct is created by the [`split_inclusive`] method on [`str`]. /// See its documentation for more. /// -/// [`split_inclusive`]: ../../std/primitive.str.html#method.split_inclusive -/// [`str`]: ../../std/primitive.str.html +/// [`split_inclusive`]: str::split_inclusive #[unstable(feature = "split_inclusive", issue = "72360")] pub struct SplitInclusive<'a, P: Pattern<'a>>(SplitInternal<'a, P>); @@ -4761,13 +4690,10 @@ impl<'a, P: Pattern<'a>> FusedIterator for SplitInclusive<'a, P> {} /// An iterator of [`u16`] over the string encoded as UTF-16. /// -/// [`u16`]: ../../std/primitive.u16.html -/// /// This struct is created by the [`encode_utf16`] method on [`str`]. /// See its documentation for more. /// -/// [`encode_utf16`]: ../../std/primitive.str.html#method.encode_utf16 -/// [`str`]: ../../std/primitive.str.html +/// [`encode_utf16`]: str::encode_utf16 #[derive(Clone)] #[stable(feature = "encode_utf16", since = "1.8.0")] pub struct EncodeUtf16<'a> { @@ -4818,8 +4744,6 @@ impl<'a> Iterator for EncodeUtf16<'a> { impl FusedIterator for EncodeUtf16<'_> {} /// The return type of [`str::escape_debug`]. -/// -/// [`str::escape_debug`]: ../../std/primitive.str.html#method.escape_debug #[stable(feature = "str_escape", since = "1.34.0")] #[derive(Clone, Debug)] pub struct EscapeDebug<'a> { @@ -4830,8 +4754,6 @@ pub struct EscapeDebug<'a> { } /// The return type of [`str::escape_default`]. -/// -/// [`str::escape_default`]: ../../std/primitive.str.html#method.escape_default #[stable(feature = "str_escape", since = "1.34.0")] #[derive(Clone, Debug)] pub struct EscapeDefault<'a> { @@ -4839,8 +4761,6 @@ pub struct EscapeDefault<'a> { } /// The return type of [`str::escape_unicode`]. -/// -/// [`str::escape_unicode`]: ../../std/primitive.str.html#method.escape_unicode #[stable(feature = "str_escape", since = "1.34.0")] #[derive(Clone, Debug)] pub struct EscapeUnicode<'a> {