@@ -9,12 +9,12 @@ impl bool {
99 /// ```
1010 /// #![feature(bool_to_option)]
1111 ///
12- /// assert_eq!(false.to_option (0), None);
13- /// assert_eq!(true.to_option (0), Some(0));
12+ /// assert_eq!(false.then_some (0), None);
13+ /// assert_eq!(true.then_some (0), Some(0));
1414 /// ```
1515 #[ unstable( feature = "bool_to_option" , issue = "64260" ) ]
1616 #[ inline]
17- pub fn to_option < T > ( self , t : T ) -> Option < T > {
17+ pub fn then_some < T > ( self , t : T ) -> Option < T > {
1818 if self {
1919 Some ( t)
2020 } else {
@@ -29,12 +29,12 @@ impl bool {
2929 /// ```
3030 /// #![feature(bool_to_option)]
3131 ///
32- /// assert_eq!(false.to_option_with (|| 0), None);
33- /// assert_eq!(true.to_option_with (|| 0), Some(0));
32+ /// assert_eq!(false.then (|| 0), None);
33+ /// assert_eq!(true.then (|| 0), Some(0));
3434 /// ```
3535 #[ unstable( feature = "bool_to_option" , issue = "64260" ) ]
3636 #[ inline]
37- pub fn to_option_with < T , F : FnOnce ( ) -> T > ( self , f : F ) -> Option < T > {
37+ pub fn then < T , F : FnOnce ( ) -> T > ( self , f : F ) -> Option < T > {
3838 if self {
3939 Some ( f ( ) )
4040 } else {
0 commit comments