diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2013-12-03 19:18:58 -0800 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2013-12-10 15:13:12 -0800 |
| commit | 7cac9fe76349120ea2373f3ce47a561271b5e8b6 (patch) | |
| tree | 495b1694a3fa4b84ede3f962b24e703363d64d80 /src/libstd/task | |
| parent | 786dea207d5b891d37e596e96dd2f84c4cb59f49 (diff) | |
| download | rust-7cac9fe76349120ea2373f3ce47a561271b5e8b6.tar.gz rust-7cac9fe76349120ea2373f3ce47a561271b5e8b6.zip | |
librustuv: RAII-ify `Local::borrow`, and remove some 12 Cells.
Diffstat (limited to 'src/libstd/task')
| -rw-r--r-- | src/libstd/task/mod.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/libstd/task/mod.rs b/src/libstd/task/mod.rs index 1777a523073..24a24f24818 100644 --- a/src/libstd/task/mod.rs +++ b/src/libstd/task/mod.rs @@ -429,12 +429,11 @@ pub fn with_task_name<U>(blk: |Option<&str>| -> U) -> U { use rt::task::Task; if in_green_task_context() { - Local::borrow(|task: &mut Task| { - match task.name { - Some(ref name) => blk(Some(name.as_slice())), - None => blk(None) - } - }) + let mut task = Local::borrow(None::<Task>); + match task.get().name { + Some(ref name) => blk(Some(name.as_slice())), + None => blk(None) + } } else { fail!("no task name exists in non-green task context") } @@ -456,7 +455,8 @@ pub fn failing() -> bool { use rt::task::Task; - Local::borrow(|local: &mut Task| local.unwinder.unwinding) + let mut local = Local::borrow(None::<Task>); + local.get().unwinder.unwinding } // The following 8 tests test the following 2^3 combinations: @@ -601,9 +601,9 @@ fn test_try_fail() { #[cfg(test)] fn get_sched_id() -> int { - Local::borrow(|sched: &mut ::rt::sched::Scheduler| { - sched.sched_id() as int - }) + use rt::sched::Scheduler; + let mut sched = Local::borrow(None::<Scheduler>); + sched.get().sched_id() as int } #[test] |
