Skip to content

Commit 51901ee

Browse files
committed
Rename bool's then to to_option
1 parent d0126e8 commit 51901ee

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/libcore/bool.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ impl bool {
99
/// ```
1010
/// #![feature(bool_to_option)]
1111
///
12-
/// assert_eq!(false.then(0), None);
13-
/// assert_eq!(true.then(0), Some(0));
12+
/// assert_eq!(false.to_option(0), None);
13+
/// assert_eq!(true.to_option(0), Some(0));
1414
/// ```
1515
#[unstable(feature = "bool_to_option", issue = "64260")]
1616
#[inline]
17-
pub fn then<T>(self, t: T) -> Option<T> {
17+
pub fn to_option<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.then_with(|| 0), None);
33-
/// assert_eq!(true.then_with(|| 0), Some(0));
32+
/// assert_eq!(false.to_option_with(|| 0), None);
33+
/// assert_eq!(true.to_option_with(|| 0), Some(0));
3434
/// ```
3535
#[unstable(feature = "bool_to_option", issue = "64260")]
3636
#[inline]
37-
pub fn then_with<T, F: FnOnce() -> T>(self, f: F) -> Option<T> {
37+
pub fn to_option_with<T, F: FnOnce() -> T>(self, f: F) -> Option<T> {
3838
if self {
3939
Some(f())
4040
} else {

0 commit comments

Comments
 (0)