@@ -854,55 +854,55 @@ impl<T> Option<T> {
854854 // Entry-like operations to insert if None and return a reference
855855 /////////////////////////////////////////////////////////////////////////
856856
857- /// Inserts the default value into the option if it is [`None`], then
857+ /// Inserts ` value` into the option if it is [`None`], then
858858 /// returns a mutable reference to the contained value.
859859 ///
860860 /// # Examples
861861 ///
862862 /// ```
863- /// #![feature(option_get_or_default)]
864- ///
865863 /// let mut x = None;
866864 ///
867865 /// {
868- /// let y: &mut u32 = x.get_or_default( );
869- /// assert_eq!(y, &0 );
866+ /// let y: &mut u32 = x.get_or_insert(5 );
867+ /// assert_eq!(y, &5 );
870868 ///
871869 /// *y = 7;
872870 /// }
873871 ///
874872 /// assert_eq!(x, Some(7));
875873 /// ```
876874 #[ inline]
877- #[ unstable( feature = "option_get_or_default" , issue = "82901" ) ]
878- pub fn get_or_default ( & mut self ) -> & mut T
879- where
880- T : Default ,
881- {
882- self . get_or_insert_with ( Default :: default)
875+ #[ stable( feature = "option_entry" , since = "1.20.0" ) ]
876+ pub fn get_or_insert ( & mut self , value : T ) -> & mut T {
877+ self . get_or_insert_with ( || value)
883878 }
884879
885- /// Inserts ` value` into the option if it is [`None`], then
880+ /// Inserts the default value into the option if it is [`None`], then
886881 /// returns a mutable reference to the contained value.
887882 ///
888883 /// # Examples
889884 ///
890885 /// ```
886+ /// #![feature(option_get_or_insert_default)]
887+ ///
891888 /// let mut x = None;
892889 ///
893890 /// {
894- /// let y: &mut u32 = x.get_or_insert(5 );
895- /// assert_eq!(y, &5 );
891+ /// let y: &mut u32 = x.get_or_insert_default( );
892+ /// assert_eq!(y, &0 );
896893 ///
897894 /// *y = 7;
898895 /// }
899896 ///
900897 /// assert_eq!(x, Some(7));
901898 /// ```
902899 #[ inline]
903- #[ stable( feature = "option_entry" , since = "1.20.0" ) ]
904- pub fn get_or_insert ( & mut self , value : T ) -> & mut T {
905- self . get_or_insert_with ( || value)
900+ #[ unstable( feature = "option_get_or_insert_default" , issue = "82901" ) ]
901+ pub fn get_or_insert_default ( & mut self ) -> & mut T
902+ where
903+ T : Default ,
904+ {
905+ self . get_or_insert_with ( Default :: default)
906906 }
907907
908908 /// Inserts a value computed from `f` into the option if it is [`None`],
0 commit comments