]> git.lizzy.rs Git - rust.git/commitdiff
Add links between `slice::{copy,clone}_from_slice` in docs.
authorCorey Farwell <coreyf@rwell.org>
Sat, 6 May 2017 13:31:00 +0000 (09:31 -0400)
committerCorey Farwell <coreyf@rwell.org>
Sat, 6 May 2017 17:07:18 +0000 (13:07 -0400)
src/libcollections/slice.rs

index 2eef132374e58b8a9f92c8edb37e5c101713da37..3efda1faa3b56405637a31019688775ffe8254fe 100644 (file)
@@ -1341,6 +1341,9 @@ pub fn sort_unstable_by_key<B, F>(&mut self, f: F)
     ///
     /// The length of `src` must be the same as `self`.
     ///
+    /// If `src` implements `Copy`, it can be more performant to use
+    /// [`copy_from_slice`].
+    ///
     /// # Panics
     ///
     /// This function will panic if the two slices have different lengths.
@@ -1354,6 +1357,8 @@ pub fn sort_unstable_by_key<B, F>(&mut self, f: F)
     /// dst.clone_from_slice(&src);
     /// assert!(dst == [1, 2, 3]);
     /// ```
+    ///
+    /// [`copy_from_slice`]: #method.copy_from_slice
     #[stable(feature = "clone_from_slice", since = "1.7.0")]
     pub fn clone_from_slice(&mut self, src: &[T]) where T: Clone {
         core_slice::SliceExt::clone_from_slice(self, src)
@@ -1363,6 +1368,8 @@ pub fn clone_from_slice(&mut self, src: &[T]) where T: Clone {
     ///
     /// The length of `src` must be the same as `self`.
     ///
+    /// If `src` does not implement `Copy`, use [`clone_from_slice`].
+    ///
     /// # Panics
     ///
     /// This function will panic if the two slices have different lengths.
@@ -1376,6 +1383,8 @@ pub fn clone_from_slice(&mut self, src: &[T]) where T: Clone {
     /// dst.copy_from_slice(&src);
     /// assert_eq!(src, dst);
     /// ```
+    ///
+    /// [`clone_from_slice`]: #method.clone_from_slice
     #[stable(feature = "copy_from_slice", since = "1.9.0")]
     pub fn copy_from_slice(&mut self, src: &[T]) where T: Copy {
         core_slice::SliceExt::copy_from_slice(self, src)