From 9a6ebbbeccd926dc9eed1cfc34534bebb590ec75 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Wed, 4 Dec 2013 21:28:47 -0800 Subject: [PATCH] librustdoc: Remove a couple of `Cell`s. --- src/librustdoc/html/render.rs | 5 ++--- src/librustuv/net.rs | 7 ++++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index f988cad5004..39f68ae59e8 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -33,7 +33,6 @@ //! These tasks are not parallelized (they haven't been a bottleneck yet), and //! both occur before the crate is rendered. -use std::cell::Cell; use std::comm::{SharedPort, SharedChan}; use std::comm; use std::fmt; @@ -814,9 +813,9 @@ fn render(w: io::File, cx: &mut Context, it: &clean::Item, // recurse into the items of the module as well. clean::ModuleItem(..) => { let name = item.name.get_ref().to_owned(); - let item = Cell::new(item); + let mut item = Some(item); self.recurse(name, |this| { - let item = item.take(); + let item = item.take_unwrap(); let dst = this.dst.join("index.html"); render(File::create(&dst).unwrap(), this, &item, false); diff --git a/src/librustuv/net.rs b/src/librustuv/net.rs index 1e9c4044345..a3931f213ec 100644 --- a/src/librustuv/net.rs +++ b/src/librustuv/net.rs @@ -646,7 +646,6 @@ fn drop(&mut self) { #[cfg(test)] mod test { - use std::cell::Cell; use std::comm::oneshot; use std::rt::test::*; use std::rt::rtio::{RtioTcpStream, RtioTcpListener, RtioTcpAcceptor, @@ -1071,7 +1070,7 @@ fn test_simple_homed_udp_io_bind_then_move_task_then_home_and_close() { let handle1 = sched1.make_handle(); let handle2 = sched2.make_handle(); - let tasksFriendHandle = Cell::new(sched2.make_handle()); + let tasksFriendHandle = sched2.make_handle(); let on_exit: proc(UnwindResult) = proc(exit_status) { handle1.send(Shutdown); @@ -1095,11 +1094,13 @@ unsafe fn local_io() -> &'static mut IoFactory { // block self on sched1 let scheduler: ~Scheduler = Local::take(); + let mut tasksFriendHandle = Some(tasksFriendHandle); scheduler.deschedule_running_task_and_then(|_, task| { // unblock task task.wake().map(|task| { // send self to sched2 - tasksFriendHandle.take().send(TaskFromFriend(task)); + tasksFriendHandle.take_unwrap() + .send(TaskFromFriend(task)); }); // sched1 should now sleep since it has nothing else to do })