about summary refs log tree commit diff
diff options
context:
space:
mode:
authorvarkor <github@varkor.com>2019-10-08 00:05:13 +0100
committervarkor <github@varkor.com>2019-12-06 12:20:08 +0000
commit51901eea8c918fd55506b3e6311857d4f5bd1ba5 (patch)
treefe08ceccca848b84ab9d8f4d1303f10211e666c0
parentd0126e8ed3cc0d6fcb9dd44c36a46f9ce65010a0 (diff)
downloadrust-51901eea8c918fd55506b3e6311857d4f5bd1ba5.tar.gz
rust-51901eea8c918fd55506b3e6311857d4f5bd1ba5.zip
Rename `bool`'s `then` to `to_option`
-rw-r--r--src/libcore/bool.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libcore/bool.rs b/src/libcore/bool.rs
index 617bdd238f4..aa1ba7affc1 100644
--- a/src/libcore/bool.rs
+++ b/src/libcore/bool.rs
@@ -9,12 +9,12 @@ impl bool {
     /// ```
     /// #![feature(bool_to_option)]
     ///
-    /// assert_eq!(false.then(0), None);
-    /// assert_eq!(true.then(0), Some(0));
+    /// assert_eq!(false.to_option(0), None);
+    /// assert_eq!(true.to_option(0), Some(0));
     /// ```
     #[unstable(feature = "bool_to_option", issue = "64260")]
     #[inline]
-    pub fn then<T>(self, t: T) -> Option<T> {
+    pub fn to_option<T>(self, t: T) -> Option<T> {
         if self {
             Some(t)
         } else {
@@ -29,12 +29,12 @@ impl bool {
     /// ```
     /// #![feature(bool_to_option)]
     ///
-    /// assert_eq!(false.then_with(|| 0), None);
-    /// assert_eq!(true.then_with(|| 0), Some(0));
+    /// assert_eq!(false.to_option_with(|| 0), None);
+    /// assert_eq!(true.to_option_with(|| 0), Some(0));
     /// ```
     #[unstable(feature = "bool_to_option", issue = "64260")]
     #[inline]
-    pub fn then_with<T, F: FnOnce() -> T>(self, f: F) -> Option<T> {
+    pub fn to_option_with<T, F: FnOnce() -> T>(self, f: F) -> Option<T> {
         if self {
             Some(f())
         } else {