From: Corey Farwell Date: Sat, 6 May 2017 13:31:00 +0000 (-0400) Subject: Add links between `slice::{copy,clone}_from_slice` in docs. X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=65e56fad98d4ab52546fdf72dc7d57049c912986;p=rust.git Add links between `slice::{copy,clone}_from_slice` in docs. --- diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs index 2eef132374e..3efda1faa3b 100644 --- a/src/libcollections/slice.rs +++ b/src/libcollections/slice.rs @@ -1341,6 +1341,9 @@ pub fn sort_unstable_by_key(&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(&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)