Skip to content

Commit 14e23f1

Browse files
committed
convert slice doc link to intra-doc links
1 parent 8f349be commit 14e23f1

File tree

2 files changed

+58
-59
lines changed

2 files changed

+58
-59
lines changed

library/alloc/src/slice.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ impl<T> [T] {
231231
///
232232
/// When applicable, unstable sorting is preferred because it is generally faster than stable
233233
/// sorting and it doesn't allocate auxiliary memory.
234-
/// See [`sort_unstable`](#method.sort_unstable).
234+
/// See [`sort_unstable`](slice::sort_unstable).
235235
///
236236
/// # Current implementation
237237
///
@@ -282,7 +282,7 @@ impl<T> [T] {
282282
///
283283
/// When applicable, unstable sorting is preferred because it is generally faster than stable
284284
/// sorting and it doesn't allocate auxiliary memory.
285-
/// See [`sort_unstable_by`](#method.sort_unstable_by).
285+
/// See [`sort_unstable_by`](slice::sort_unstable_by).
286286
///
287287
/// # Current implementation
288288
///
@@ -320,12 +320,12 @@ impl<T> [T] {
320320
/// worst-case, where the key function is *O*(*m*).
321321
///
322322
/// For expensive key functions (e.g. functions that are not simple property accesses or
323-
/// basic operations), [`sort_by_cached_key`](#method.sort_by_cached_key) is likely to be
323+
/// basic operations), [`sort_by_cached_key`](slice::sort_by_cached_key) is likely to be
324324
/// significantly faster, as it does not recompute element keys.
325325
///
326326
/// When applicable, unstable sorting is preferred because it is generally faster than stable
327327
/// sorting and it doesn't allocate auxiliary memory.
328-
/// See [`sort_unstable_by_key`](#method.sort_unstable_by_key).
328+
/// See [`sort_unstable_by_key`](slice::sort_unstable_by_key).
329329
///
330330
/// # Current implementation
331331
///
@@ -363,7 +363,7 @@ impl<T> [T] {
363363
/// worst-case, where the key function is *O*(*m*).
364364
///
365365
/// For simple key functions (e.g., functions that are property accesses or
366-
/// basic operations), [`sort_by_key`](#method.sort_by_key) is likely to be
366+
/// basic operations), [`sort_by_key`](slice::sort_by_key) is likely to be
367367
/// faster.
368368
///
369369
/// # Current implementation

library/core/src/slice/mod.rs

Lines changed: 53 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ impl<T> [T] {
308308
/// Returns a mutable reference to an element or subslice depending on the
309309
/// type of index (see [`get`]) or `None` if the index is out of bounds.
310310
///
311-
/// [`get`]: #method.get
311+
/// [`get`]: slice::get
312312
///
313313
/// # Examples
314314
///
@@ -339,7 +339,7 @@ impl<T> [T] {
339339
/// Calling this method with an out-of-bounds index is *[undefined behavior]*
340340
/// even if the resulting reference is not used.
341341
///
342-
/// [`get`]: #method.get
342+
/// [`get`]: slice::get
343343
/// [undefined behavior]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html
344344
///
345345
/// # Examples
@@ -373,7 +373,7 @@ impl<T> [T] {
373373
/// Calling this method with an out-of-bounds index is *[undefined behavior]*
374374
/// even if the resulting reference is not used.
375375
///
376-
/// [`get_mut`]: #method.get_mut
376+
/// [`get_mut`]: slice::get_mut
377377
/// [undefined behavior]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html
378378
///
379379
/// # Examples
@@ -424,7 +424,7 @@ impl<T> [T] {
424424
/// }
425425
/// ```
426426
///
427-
/// [`as_mut_ptr`]: #method.as_mut_ptr
427+
/// [`as_mut_ptr`]: slice::as_mut_ptr
428428
#[stable(feature = "rust1", since = "1.0.0")]
429429
#[rustc_const_stable(feature = "const_slice_as_ptr", since = "1.32.0")]
430430
#[inline]
@@ -487,7 +487,7 @@ impl<T> [T] {
487487
/// assert!(!a.as_ptr_range().contains(&y));
488488
/// ```
489489
///
490-
/// [`as_ptr`]: #method.as_ptr
490+
/// [`as_ptr`]: slice::as_ptr
491491
#[stable(feature = "slice_ptr_range", since = "1.48.0")]
492492
#[rustc_const_unstable(feature = "const_ptr_offset", issue = "71499")]
493493
#[inline]
@@ -529,7 +529,7 @@ impl<T> [T] {
529529
/// use two pointers to refer to a range of elements in memory, as is
530530
/// common in C++.
531531
///
532-
/// [`as_mut_ptr`]: #method.as_mut_ptr
532+
/// [`as_mut_ptr`]: slice::as_mut_ptr
533533
#[stable(feature = "slice_ptr_range", since = "1.48.0")]
534534
#[rustc_const_unstable(feature = "const_ptr_offset", issue = "71499")]
535535
#[inline]
@@ -780,8 +780,8 @@ impl<T> [T] {
780780
/// assert!(iter.next().is_none());
781781
/// ```
782782
///
783-
/// [`chunks_exact`]: #method.chunks_exact
784-
/// [`rchunks`]: #method.rchunks
783+
/// [`chunks_exact`]: slice::chunks_exact
784+
/// [`rchunks`]: slice::rchunks
785785
#[stable(feature = "rust1", since = "1.0.0")]
786786
#[inline]
787787
pub fn chunks(&self, chunk_size: usize) -> Chunks<'_, T> {
@@ -818,8 +818,8 @@ impl<T> [T] {
818818
/// assert_eq!(v, &[1, 1, 2, 2, 3]);
819819
/// ```
820820
///
821-
/// [`chunks_exact_mut`]: #method.chunks_exact_mut
822-
/// [`rchunks_mut`]: #method.rchunks_mut
821+
/// [`chunks_exact_mut`]: slice::chunks_exact_mut
822+
/// [`rchunks_mut`]: slice::rchunks_mut
823823
#[stable(feature = "rust1", since = "1.0.0")]
824824
#[inline]
825825
pub fn chunks_mut(&mut self, chunk_size: usize) -> ChunksMut<'_, T> {
@@ -855,8 +855,8 @@ impl<T> [T] {
855855
/// assert_eq!(iter.remainder(), &['m']);
856856
/// ```
857857
///
858-
/// [`chunks`]: #method.chunks
859-
/// [`rchunks_exact`]: #method.rchunks_exact
858+
/// [`chunks`]: slice::chunks
859+
/// [`rchunks_exact`]: slice::rchunks_exact
860860
#[stable(feature = "chunks_exact", since = "1.31.0")]
861861
#[inline]
862862
pub fn chunks_exact(&self, chunk_size: usize) -> ChunksExact<'_, T> {
@@ -897,8 +897,8 @@ impl<T> [T] {
897897
/// assert_eq!(v, &[1, 1, 2, 2, 0]);
898898
/// ```
899899
///
900-
/// [`chunks_mut`]: #method.chunks_mut
901-
/// [`rchunks_exact_mut`]: #method.rchunks_exact_mut
900+
/// [`chunks_mut`]: slice::chunks_mut
901+
/// [`rchunks_exact_mut`]: slice::rchunks_exact_mut
902902
#[stable(feature = "chunks_exact", since = "1.31.0")]
903903
#[inline]
904904
pub fn chunks_exact_mut(&mut self, chunk_size: usize) -> ChunksExactMut<'_, T> {
@@ -1032,7 +1032,7 @@ impl<T> [T] {
10321032
/// assert_eq!(iter.remainder(), &['m']);
10331033
/// ```
10341034
///
1035-
/// [`chunks_exact`]: #method.chunks_exact
1035+
/// [`chunks_exact`]: slice::chunks_exact
10361036
#[unstable(feature = "array_chunks", issue = "74985")]
10371037
#[inline]
10381038
pub fn array_chunks<const N: usize>(&self) -> ArrayChunks<'_, T, N> {
@@ -1182,7 +1182,7 @@ impl<T> [T] {
11821182
/// assert_eq!(v, &[1, 1, 2, 2, 0]);
11831183
/// ```
11841184
///
1185-
/// [`chunks_exact_mut`]: #method.chunks_exact_mut
1185+
/// [`chunks_exact_mut`]: slice::chunks_exact_mut
11861186
#[unstable(feature = "array_chunks", issue = "74985")]
11871187
#[inline]
11881188
pub fn array_chunks_mut<const N: usize>(&mut self) -> ArrayChunksMut<'_, T, N> {
@@ -1214,7 +1214,7 @@ impl<T> [T] {
12141214
/// assert!(iter.next().is_none());
12151215
/// ```
12161216
///
1217-
/// [`windows`]: #method.windows
1217+
/// [`windows`]: slice::windows
12181218
#[unstable(feature = "array_windows", issue = "75027")]
12191219
#[inline]
12201220
pub fn array_windows<const N: usize>(&self) -> ArrayWindows<'_, T, N> {
@@ -1247,8 +1247,8 @@ impl<T> [T] {
12471247
/// assert!(iter.next().is_none());
12481248
/// ```
12491249
///
1250-
/// [`rchunks_exact`]: #method.rchunks_exact
1251-
/// [`chunks`]: #method.chunks
1250+
/// [`rchunks_exact`]: slice::rchunks_exact
1251+
/// [`chunks`]: slice::chunks
12521252
#[stable(feature = "rchunks", since = "1.31.0")]
12531253
#[inline]
12541254
pub fn rchunks(&self, chunk_size: usize) -> RChunks<'_, T> {
@@ -1285,8 +1285,8 @@ impl<T> [T] {
12851285
/// assert_eq!(v, &[3, 2, 2, 1, 1]);
12861286
/// ```
12871287
///
1288-
/// [`rchunks_exact_mut`]: #method.rchunks_exact_mut
1289-
/// [`chunks_mut`]: #method.chunks_mut
1288+
/// [`rchunks_exact_mut`]: slice::rchunks_exact_mut
1289+
/// [`chunks_mut`]: slice::chunks_mut
12901290
#[stable(feature = "rchunks", since = "1.31.0")]
12911291
#[inline]
12921292
pub fn rchunks_mut(&mut self, chunk_size: usize) -> RChunksMut<'_, T> {
@@ -1323,9 +1323,9 @@ impl<T> [T] {
13231323
/// assert_eq!(iter.remainder(), &['l']);
13241324
/// ```
13251325
///
1326-
/// [`chunks`]: #method.chunks
1327-
/// [`rchunks`]: #method.rchunks
1328-
/// [`chunks_exact`]: #method.chunks_exact
1326+
/// [`chunks`]: slice::chunks
1327+
/// [`rchunks`]: slice::rchunks
1328+
/// [`chunks_exact`]: slice::chunks_exact
13291329
#[stable(feature = "rchunks", since = "1.31.0")]
13301330
#[inline]
13311331
pub fn rchunks_exact(&self, chunk_size: usize) -> RChunksExact<'_, T> {
@@ -1366,9 +1366,9 @@ impl<T> [T] {
13661366
/// assert_eq!(v, &[0, 2, 2, 1, 1]);
13671367
/// ```
13681368
///
1369-
/// [`chunks_mut`]: #method.chunks_mut
1370-
/// [`rchunks_mut`]: #method.rchunks_mut
1371-
/// [`chunks_exact_mut`]: #method.chunks_exact_mut
1369+
/// [`chunks_mut`]: slice::chunks_mut
1370+
/// [`rchunks_mut`]: slice::rchunks_mut
1371+
/// [`chunks_exact_mut`]: slice::chunks_exact_mut
13721372
#[stable(feature = "rchunks", since = "1.31.0")]
13731373
#[inline]
13741374
pub fn rchunks_exact_mut(&mut self, chunk_size: usize) -> RChunksExactMut<'_, T> {
@@ -1552,7 +1552,7 @@ impl<T> [T] {
15521552
/// even if the resulting reference is not used. The caller has to ensure that
15531553
/// `0 <= mid <= self.len()`.
15541554
///
1555-
/// [`split_at`]: #method.split_at
1555+
/// [`split_at`]: slice::split_at
15561556
/// [undefined behavior]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html
15571557
///
15581558
/// # Examples
@@ -1601,7 +1601,7 @@ impl<T> [T] {
16011601
/// even if the resulting reference is not used. The caller has to ensure that
16021602
/// `0 <= mid <= self.len()`.
16031603
///
1604-
/// [`split_at_mut`]: #method.split_at_mut
1604+
/// [`split_at_mut`]: slice::split_at_mut
16051605
/// [undefined behavior]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html
16061606
///
16071607
/// # Examples
@@ -2103,9 +2103,9 @@ impl<T> [T] {
21032103
///
21042104
/// See also [`binary_search_by`], [`binary_search_by_key`], and [`partition_point`].
21052105
///
2106-
/// [`binary_search_by`]: #method.binary_search_by
2107-
/// [`binary_search_by_key`]: #method.binary_search_by_key
2108-
/// [`partition_point`]: #method.partition_point
2106+
/// [`binary_search_by`]: slice::binary_search_by
2107+
/// [`binary_search_by_key`]: slice::binary_search_by_key
2108+
/// [`partition_point`]: slice::partition_point
21092109
///
21102110
/// # Examples
21112111
///
@@ -2156,9 +2156,9 @@ impl<T> [T] {
21562156
///
21572157
/// See also [`binary_search`], [`binary_search_by_key`], and [`partition_point`].
21582158
///
2159-
/// [`binary_search`]: #method.binary_search
2160-
/// [`binary_search_by_key`]: #method.binary_search_by_key
2161-
/// [`partition_point`]: #method.partition_point
2159+
/// [`binary_search`]: slice::binary_search
2160+
/// [`binary_search_by_key`]: slice::binary_search_by_key
2161+
/// [`partition_point`]: slice::partition_point
21622162
///
21632163
/// # Examples
21642164
///
@@ -2215,7 +2215,7 @@ impl<T> [T] {
22152215
/// Binary searches this sorted slice with a key extraction function.
22162216
///
22172217
/// Assumes that the slice is sorted by the key, for instance with
2218-
/// [`sort_by_key`] using the same key extraction function.
2218+
/// `sort_by_key` using the same key extraction function.
22192219
///
22202220
/// If the value is found then [`Result::Ok`] is returned, containing the
22212221
/// index of the matching element. If there are multiple matches, then any
@@ -2225,10 +2225,9 @@ impl<T> [T] {
22252225
///
22262226
/// See also [`binary_search`], [`binary_search_by`], and [`partition_point`].
22272227
///
2228-
/// [`sort_by_key`]: #method.sort_by_key
2229-
/// [`binary_search`]: #method.binary_search
2230-
/// [`binary_search_by`]: #method.binary_search_by
2231-
/// [`partition_point`]: #method.partition_point
2228+
/// [`binary_search`]: slice::binary_search
2229+
/// [`binary_search_by`]: slice::binary_search_by
2230+
/// [`partition_point`]: slice::partition_point
22322231
///
22332232
/// # Examples
22342233
///
@@ -2446,7 +2445,7 @@ impl<T> [T] {
24462445
/// The current algorithm is based on the quickselect portion of the same quicksort algorithm
24472446
/// used for [`sort_unstable`].
24482447
///
2449-
/// [`sort_unstable`]: #method.sort_unstable
2448+
/// [`sort_unstable`]: slice::sort_unstable
24502449
///
24512450
/// # Panics
24522451
///
@@ -2494,7 +2493,7 @@ impl<T> [T] {
24942493
/// The current algorithm is based on the quickselect portion of the same quicksort algorithm
24952494
/// used for [`sort_unstable`].
24962495
///
2497-
/// [`sort_unstable`]: #method.sort_unstable
2496+
/// [`sort_unstable`]: slice::sort_unstable
24982497
///
24992498
/// # Panics
25002499
///
@@ -2546,7 +2545,7 @@ impl<T> [T] {
25462545
/// The current algorithm is based on the quickselect portion of the same quicksort algorithm
25472546
/// used for [`sort_unstable`].
25482547
///
2549-
/// [`sort_unstable`]: #method.sort_unstable
2548+
/// [`sort_unstable`]: slice::sort_unstable
25502549
///
25512550
/// # Panics
25522551
///
@@ -2883,7 +2882,7 @@ impl<T> [T] {
28832882
/// trait to generate values, you can pass [`Default::default`] as the
28842883
/// argument.
28852884
///
2886-
/// [`fill`]: #method.fill
2885+
/// [`fill`]: slice::fill
28872886
///
28882887
/// # Examples
28892888
///
@@ -2956,8 +2955,8 @@ impl<T> [T] {
29562955
/// assert_eq!(slice, [4, 5, 3, 4, 5]);
29572956
/// ```
29582957
///
2959-
/// [`copy_from_slice`]: #method.copy_from_slice
2960-
/// [`split_at_mut`]: #method.split_at_mut
2958+
/// [`copy_from_slice`]: slice::copy_from_slice
2959+
/// [`split_at_mut`]: slice::split_at_mut
29612960
#[stable(feature = "clone_from_slice", since = "1.7.0")]
29622961
pub fn clone_from_slice(&mut self, src: &[T])
29632962
where
@@ -3018,8 +3017,8 @@ impl<T> [T] {
30183017
/// assert_eq!(slice, [4, 5, 3, 4, 5]);
30193018
/// ```
30203019
///
3021-
/// [`clone_from_slice`]: #method.clone_from_slice
3022-
/// [`split_at_mut`]: #method.split_at_mut
3020+
/// [`clone_from_slice`]: slice::clone_from_slice
3021+
/// [`split_at_mut`]: slice::split_at_mut
30233022
#[doc(alias = "memcpy")]
30243023
#[stable(feature = "copy_from_slice", since = "1.9.0")]
30253024
pub fn copy_from_slice(&mut self, src: &[T])
@@ -3136,7 +3135,7 @@ impl<T> [T] {
31363135
/// assert_eq!(slice, [4, 5, 3, 1, 2]);
31373136
/// ```
31383137
///
3139-
/// [`split_at_mut`]: #method.split_at_mut
3138+
/// [`split_at_mut`]: slice::split_at_mut
31403139
#[stable(feature = "swap_with_slice", since = "1.27.0")]
31413140
pub fn swap_with_slice(&mut self, other: &mut [T]) {
31423141
assert!(self.len() == other.len(), "destination and source slices have different lengths");
@@ -3380,7 +3379,7 @@ impl<T> [T] {
33803379
/// function to determine the ordering of two elements. Apart from that, it's equivalent to
33813380
/// [`is_sorted`]; see its documentation for more information.
33823381
///
3383-
/// [`is_sorted`]: #method.is_sorted
3382+
/// [`is_sorted`]: slice::is_sorted
33843383
#[unstable(feature = "is_sorted", reason = "new API", issue = "53485")]
33853384
pub fn is_sorted_by<F>(&self, mut compare: F) -> bool
33863385
where
@@ -3395,7 +3394,7 @@ impl<T> [T] {
33953394
/// elements, as determined by `f`. Apart from that, it's equivalent to [`is_sorted`]; see its
33963395
/// documentation for more information.
33973396
///
3398-
/// [`is_sorted`]: #method.is_sorted
3397+
/// [`is_sorted`]: slice::is_sorted
33993398
///
34003399
/// # Examples
34013400
///
@@ -3429,9 +3428,9 @@ impl<T> [T] {
34293428
///
34303429
/// See also [`binary_search`], [`binary_search_by`], and [`binary_search_by_key`].
34313430
///
3432-
/// [`binary_search`]: #method.binary_search
3433-
/// [`binary_search_by`]: #method.binary_search_by
3434-
/// [`binary_search_by_key`]: #method.binary_search_by_key
3431+
/// [`binary_search`]: slice::binary_search
3432+
/// [`binary_search_by`]: slice::binary_search_by
3433+
/// [`binary_search_by_key`]: slice::binary_search_by_key
34353434
///
34363435
/// # Examples
34373436
///

0 commit comments

Comments
 (0)