]> git.lizzy.rs Git - rust.git/commitdiff
std: removed option.take_map{,_default}
authorErick Tryzelaar <erick.tryzelaar@gmail.com>
Sun, 4 Aug 2013 23:30:51 +0000 (16:30 -0700)
committerErick Tryzelaar <erick.tryzelaar@gmail.com>
Wed, 7 Aug 2013 15:52:09 +0000 (08:52 -0700)
src/libstd/option.rs
src/libstd/rt/kill.rs

index e43ff65da5e518f365c4164961c3c147cb63a29c..66b30d8dd031c288eb2200fd4f35d69553f5a35b 100644 (file)
@@ -241,20 +241,6 @@ pub fn take(&mut self) -> Option<T> {
         util::replace(self, None)
     }
 
-    /// As `map_move`, but swaps a None into the original option rather
-    /// than consuming it by-value.
-    #[inline]
-    pub fn take_map<U>(&mut self, blk: &fn(T) -> U) -> Option<U> {
-        self.take().map_move(blk)
-    }
-
-    /// As `map_move_default`, but swaps a None into the original option
-    /// rather than consuming it by-value.
-    #[inline]
-    pub fn take_map_default<U> (&mut self, def: U, blk: &fn(T) -> U) -> U {
-        self.take().map_move_default(def, blk)
-    }
-
     /// Apply a function to the contained value or do nothing.
     /// Returns true if the contained value was mutated.
     pub fn mutate(&mut self, f: &fn(T) -> T) -> bool {
index d90ad07650d2b2337b17ae9fd9efbfeeaa3a47ff..789c7531eca82221ee0a384526726cd9b838f010 100644 (file)
@@ -405,7 +405,7 @@ pub fn reparent_children_to(self, parent: &mut KillHandle) {
                         others.take().map_move_default(true, |f| f()) && {
                             let mut inner = this.take().unwrap();
                             (!inner.any_child_failed) &&
-                                inner.child_tombstones.take_map_default(true, |f| f())
+                                inner.child_tombstones.take().map_move_default(true, |f| f())
                         }
                     }
                 }
@@ -493,7 +493,7 @@ pub fn collect_failure(&mut self, mut success: bool, group: Option<Taskgroup>) {
         { use util; util::ignore(group); }
 
         // Step 1. Decide if we need to collect child failures synchronously.
-        do self.on_exit.take_map |on_exit| {
+        do self.on_exit.take().map_move |on_exit| {
             if success {
                 // We succeeded, but our children might not. Need to wait for them.
                 let mut inner = self.kill_handle.take_unwrap().unwrap();
@@ -501,7 +501,7 @@ pub fn collect_failure(&mut self, mut success: bool, group: Option<Taskgroup>) {
                     success = false;
                 } else {
                     // Lockless access to tombstones protected by unwrap barrier.
-                    success = inner.child_tombstones.take_map_default(true, |f| f());
+                    success = inner.child_tombstones.take().map_move_default(true, |f| f());
                 }
             }
             on_exit(success);
@@ -510,12 +510,12 @@ pub fn collect_failure(&mut self, mut success: bool, group: Option<Taskgroup>) {
         // Step 2. Possibly alert possibly-watching parent to failure status.
         // Note that as soon as parent_handle goes out of scope, the parent
         // can successfully unwrap its handle and collect our reported status.
-        do self.watching_parent.take_map |mut parent_handle| {
+        do self.watching_parent.take().map_move |mut parent_handle| {
             if success {
                 // Our handle might be None if we had an exit callback, and
                 // already unwrapped it. But 'success' being true means no
                 // child failed, so there's nothing to do (see below case).
-                do self.kill_handle.take_map |own_handle| {
+                do self.kill_handle.take().map_move |own_handle| {
                     own_handle.reparent_children_to(&mut parent_handle);
                 };
             } else {