@@ -670,6 +670,9 @@ pub unsafe fn uninitialized<T>() -> T {
670670
671671/// Swaps the values at two mutable locations, without deinitializing either one. 
672672/// 
673+ /// * If you want to swap with a default or dummy value, see [`take`]. 
674+ /// * If you want to swap with a passed value, returning the old value, see [`replace`]. 
675+ /// 
673676/// # Examples 
674677/// 
675678/// ``` 
@@ -683,6 +686,9 @@ pub unsafe fn uninitialized<T>() -> T {
683686/// assert_eq!(42, x); 
684687/// assert_eq!(5, y); 
685688/// ``` 
689+ /// 
690+ /// [`replace`]: fn.replace.html 
691+ /// [`take`]: fn.take.html 
686692#[ inline]  
687693#[ stable( feature = "rust1" ,  since = "1.0.0" ) ]  
688694pub  fn  swap < T > ( x :  & mut  T ,  y :  & mut  T )  { 
@@ -695,6 +701,9 @@ pub fn swap<T>(x: &mut T, y: &mut T) {
695701
696702/// Replaces `dest` with the default value of `T`, returning the previous `dest` value. 
697703/// 
704+ /// * If you want to replace the values of two variables, see [`swap`]. 
705+ /// * If you want to replace with a passed value instead of the default value, see [`replace`]. 
706+ /// 
698707/// # Examples 
699708/// 
700709/// A simple example: 
@@ -747,6 +756,8 @@ pub fn swap<T>(x: &mut T, y: &mut T) {
747756/// ``` 
748757/// 
749758/// [`Clone`]: ../../std/clone/trait.Clone.html 
759+ /// [`replace`]: fn.replace.html 
760+ /// [`swap`]: fn.swap.html 
750761#[ inline]  
751762#[ stable( feature = "mem_take" ,  since = "1.40.0" ) ]  
752763pub  fn  take < T :  Default > ( dest :  & mut  T )  -> T  { 
@@ -757,6 +768,9 @@ pub fn take<T: Default>(dest: &mut T) -> T {
757768/// 
758769/// Neither value is dropped. 
759770/// 
771+ /// * If you want to replace the values of two variables, see [`swap`]. 
772+ /// * If you want to replace with a default value, see [`take`]. 
773+ /// 
760774/// # Examples 
761775/// 
762776/// A simple example: 
@@ -810,6 +824,8 @@ pub fn take<T: Default>(dest: &mut T) -> T {
810824/// ``` 
811825/// 
812826/// [`Clone`]: ../../std/clone/trait.Clone.html 
827+ /// [`swap`]: fn.swap.html 
828+ /// [`take`]: fn.take.html 
813829#[ inline]  
814830#[ stable( feature = "rust1" ,  since = "1.0.0" ) ]  
815831#[ must_use = "if you don't need the old value, you can just assign the new value directly" ]  
0 commit comments