Skip to content

Commit 21e23b8

Browse files
authored
Rollup merge of rust-lang#132398 - krtab:add_doc_link, r=Noratrieb
Add a couple of intra-doc links to str
2 parents ecd55b1 + f0634f0 commit 21e23b8

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

core/src/str/mod.rs

+9-5
Original file line numberDiff line numberDiff line change
@@ -212,14 +212,16 @@ impl str {
212212
}
213213
}
214214

215-
/// Finds the closest `x` not exceeding `index` where `is_char_boundary(x)` is `true`.
215+
/// Finds the closest `x` not exceeding `index` where [`is_char_boundary(x)`] is `true`.
216216
///
217217
/// This method can help you truncate a string so that it's still valid UTF-8, but doesn't
218218
/// exceed a given number of bytes. Note that this is done purely at the character level
219219
/// and can still visually split graphemes, even though the underlying characters aren't
220220
/// split. For example, the emoji 🧑‍🔬 (scientist) could be split so that the string only
221221
/// includes 🧑 (person) instead.
222222
///
223+
/// [`is_char_boundary(x)`]: Self::is_char_boundary
224+
///
223225
/// # Examples
224226
///
225227
/// ```
@@ -248,15 +250,15 @@ impl str {
248250
}
249251
}
250252

251-
/// Finds the closest `x` not below `index` where `is_char_boundary(x)` is `true`.
253+
/// Finds the closest `x` not below `index` where [`is_char_boundary(x)`] is `true`.
252254
///
253255
/// If `index` is greater than the length of the string, this returns the length of the string.
254256
///
255257
/// This method is the natural complement to [`floor_char_boundary`]. See that method
256258
/// for more details.
257259
///
258260
/// [`floor_char_boundary`]: str::floor_char_boundary
259-
///
261+
/// [`is_char_boundary(x)`]: Self::is_char_boundary
260262
///
261263
/// # Examples
262264
///
@@ -2192,7 +2194,7 @@ impl str {
21922194
/// Returns a string slice with the prefix removed.
21932195
///
21942196
/// If the string starts with the pattern `prefix`, returns the substring after the prefix,
2195-
/// wrapped in `Some`. Unlike `trim_start_matches`, this method removes the prefix exactly once.
2197+
/// wrapped in `Some`. Unlike [`trim_start_matches`], this method removes the prefix exactly once.
21962198
///
21972199
/// If the string does not start with `prefix`, returns `None`.
21982200
///
@@ -2201,6 +2203,7 @@ impl str {
22012203
///
22022204
/// [`char`]: prim@char
22032205
/// [pattern]: self::pattern
2206+
/// [`trim_start_matches`]: Self::trim_start_matches
22042207
///
22052208
/// # Examples
22062209
///
@@ -2219,7 +2222,7 @@ impl str {
22192222
/// Returns a string slice with the suffix removed.
22202223
///
22212224
/// If the string ends with the pattern `suffix`, returns the substring before the suffix,
2222-
/// wrapped in `Some`. Unlike `trim_end_matches`, this method removes the suffix exactly once.
2225+
/// wrapped in `Some`. Unlike [`trim_end_matches`], this method removes the suffix exactly once.
22232226
///
22242227
/// If the string does not end with `suffix`, returns `None`.
22252228
///
@@ -2228,6 +2231,7 @@ impl str {
22282231
///
22292232
/// [`char`]: prim@char
22302233
/// [pattern]: self::pattern
2234+
/// [`trim_end_matches`]: Self::trim_end_matches
22312235
///
22322236
/// # Examples
22332237
///

0 commit comments

Comments
 (0)