From df8c20d7a5ddb84eb1e5fd2c366f51d357306f34 Mon Sep 17 00:00:00 2001 From: Arthur Carcano Date: Wed, 30 Oct 2024 16:40:55 +0100 Subject: [PATCH 1/2] Add intra-doc link in str::xxx_prefix --- library/core/src/str/mod.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/library/core/src/str/mod.rs b/library/core/src/str/mod.rs index 89addc4cb74..4c2d43b9ede 100644 --- a/library/core/src/str/mod.rs +++ b/library/core/src/str/mod.rs @@ -2169,7 +2169,7 @@ pub fn trim_start_matches(&self, pat: P) -> &str { /// Returns a string slice with the prefix removed. /// /// If the string starts with the pattern `prefix`, returns the substring after the prefix, - /// wrapped in `Some`. Unlike `trim_start_matches`, this method removes the prefix exactly once. + /// wrapped in `Some`. Unlike [`trim_start_matches`], this method removes the prefix exactly once. /// /// If the string does not start with `prefix`, returns `None`. /// @@ -2178,6 +2178,7 @@ pub fn trim_start_matches(&self, pat: P) -> &str { /// /// [`char`]: prim@char /// [pattern]: self::pattern + /// [`trim_start_matches`]: Self::trim_start_matches /// /// # Examples /// @@ -2196,7 +2197,7 @@ pub fn strip_prefix(&self, prefix: P) -> Option<&str> { /// Returns a string slice with the suffix removed. /// /// If the string ends with the pattern `suffix`, returns the substring before the suffix, - /// wrapped in `Some`. Unlike `trim_end_matches`, this method removes the suffix exactly once. + /// wrapped in `Some`. Unlike [`trim_end_matches`], this method removes the suffix exactly once. /// /// If the string does not end with `suffix`, returns `None`. /// @@ -2205,6 +2206,7 @@ pub fn strip_prefix(&self, prefix: P) -> Option<&str> { /// /// [`char`]: prim@char /// [pattern]: self::pattern + /// [`trim_end_matches`]: Self::trim_end_matches /// /// # Examples /// From df445264b3e97cb3e2845f6fbb9ae541225f86cf Mon Sep 17 00:00:00 2001 From: Arthur Carcano Date: Wed, 30 Oct 2024 16:50:55 +0100 Subject: [PATCH 2/2] Add intra-doc link in str::xxx_char_boundary --- library/core/src/str/mod.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/library/core/src/str/mod.rs b/library/core/src/str/mod.rs index 4c2d43b9ede..208ad9e7e5f 100644 --- a/library/core/src/str/mod.rs +++ b/library/core/src/str/mod.rs @@ -211,7 +211,7 @@ pub fn is_char_boundary(&self, index: usize) -> bool { } } - /// Finds the closest `x` not exceeding `index` where `is_char_boundary(x)` is `true`. + /// Finds the closest `x` not exceeding `index` where [`is_char_boundary(x)`] is `true`. /// /// This method can help you truncate a string so that it's still valid UTF-8, but doesn't /// exceed a given number of bytes. Note that this is done purely at the character level @@ -219,6 +219,8 @@ pub fn is_char_boundary(&self, index: usize) -> bool { /// split. For example, the emoji 🧑‍🔬 (scientist) could be split so that the string only /// includes 🧑 (person) instead. /// + /// [`is_char_boundary(x)`]: Self::is_char_boundary + /// /// # Examples /// /// ``` @@ -247,7 +249,7 @@ pub fn floor_char_boundary(&self, index: usize) -> usize { } } - /// Finds the closest `x` not below `index` where `is_char_boundary(x)` is `true`. + /// Finds the closest `x` not below `index` where [`is_char_boundary(x)`] is `true`. /// /// If `index` is greater than the length of the string, this returns the length of the string. /// @@ -255,7 +257,7 @@ pub fn floor_char_boundary(&self, index: usize) -> usize { /// for more details. /// /// [`floor_char_boundary`]: str::floor_char_boundary - /// + /// [`is_char_boundary(x)`]: Self::is_char_boundary /// /// # Examples ///