Skip to content

Commit 19e17f5

Browse files
committed
std: removed option.take_map{,_default}
1 parent 1e49081 commit 19e17f5

File tree

2 files changed

+5
-19
lines changed

2 files changed

+5
-19
lines changed

src/libstd/option.rs

-14
Original file line numberDiff line numberDiff line change
@@ -241,20 +241,6 @@ impl<T> Option<T> {
241241
util::replace(self, None)
242242
}
243243

244-
/// As `map_move`, but swaps a None into the original option rather
245-
/// than consuming it by-value.
246-
#[inline]
247-
pub fn take_map<U>(&mut self, blk: &fn(T) -> U) -> Option<U> {
248-
self.take().map_move(blk)
249-
}
250-
251-
/// As `map_move_default`, but swaps a None into the original option
252-
/// rather than consuming it by-value.
253-
#[inline]
254-
pub fn take_map_default<U> (&mut self, def: U, blk: &fn(T) -> U) -> U {
255-
self.take().map_move_default(def, blk)
256-
}
257-
258244
/// Apply a function to the contained value or do nothing.
259245
/// Returns true if the contained value was mutated.
260246
pub fn mutate(&mut self, f: &fn(T) -> T) -> bool {

src/libstd/rt/kill.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ impl KillHandle {
405405
others.take().map_move_default(true, |f| f()) && {
406406
let mut inner = this.take().unwrap();
407407
(!inner.any_child_failed) &&
408-
inner.child_tombstones.take_map_default(true, |f| f())
408+
inner.child_tombstones.take().map_move_default(true, |f| f())
409409
}
410410
}
411411
}
@@ -493,15 +493,15 @@ impl Death {
493493
{ use util; util::ignore(group); }
494494

495495
// Step 1. Decide if we need to collect child failures synchronously.
496-
do self.on_exit.take_map |on_exit| {
496+
do self.on_exit.take().map_move |on_exit| {
497497
if success {
498498
// We succeeded, but our children might not. Need to wait for them.
499499
let mut inner = self.kill_handle.take_unwrap().unwrap();
500500
if inner.any_child_failed {
501501
success = false;
502502
} else {
503503
// Lockless access to tombstones protected by unwrap barrier.
504-
success = inner.child_tombstones.take_map_default(true, |f| f());
504+
success = inner.child_tombstones.take().map_move_default(true, |f| f());
505505
}
506506
}
507507
on_exit(success);
@@ -510,12 +510,12 @@ impl Death {
510510
// Step 2. Possibly alert possibly-watching parent to failure status.
511511
// Note that as soon as parent_handle goes out of scope, the parent
512512
// can successfully unwrap its handle and collect our reported status.
513-
do self.watching_parent.take_map |mut parent_handle| {
513+
do self.watching_parent.take().map_move |mut parent_handle| {
514514
if success {
515515
// Our handle might be None if we had an exit callback, and
516516
// already unwrapped it. But 'success' being true means no
517517
// child failed, so there's nothing to do (see below case).
518-
do self.kill_handle.take_map |own_handle| {
518+
do self.kill_handle.take().map_move |own_handle| {
519519
own_handle.reparent_children_to(&mut parent_handle);
520520
};
521521
} else {

0 commit comments

Comments
 (0)