librustdoc: Remove a couple of Cells.

This commit is contained in:
Patrick Walton 2013-12-04 21:28:47 -08:00
parent ebe8ac88a7
commit 9a6ebbbecc
2 changed files with 6 additions and 6 deletions

View File

@ -33,7 +33,6 @@
//! These tasks are not parallelized (they haven't been a bottleneck yet), and //! These tasks are not parallelized (they haven't been a bottleneck yet), and
//! both occur before the crate is rendered. //! both occur before the crate is rendered.
use std::cell::Cell;
use std::comm::{SharedPort, SharedChan}; use std::comm::{SharedPort, SharedChan};
use std::comm; use std::comm;
use std::fmt; 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. // recurse into the items of the module as well.
clean::ModuleItem(..) => { clean::ModuleItem(..) => {
let name = item.name.get_ref().to_owned(); let name = item.name.get_ref().to_owned();
let item = Cell::new(item); let mut item = Some(item);
self.recurse(name, |this| { self.recurse(name, |this| {
let item = item.take(); let item = item.take_unwrap();
let dst = this.dst.join("index.html"); let dst = this.dst.join("index.html");
render(File::create(&dst).unwrap(), this, &item, false); render(File::create(&dst).unwrap(), this, &item, false);

View File

@ -646,7 +646,6 @@ fn drop(&mut self) {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use std::cell::Cell;
use std::comm::oneshot; use std::comm::oneshot;
use std::rt::test::*; use std::rt::test::*;
use std::rt::rtio::{RtioTcpStream, RtioTcpListener, RtioTcpAcceptor, 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 handle1 = sched1.make_handle();
let handle2 = sched2.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) { let on_exit: proc(UnwindResult) = proc(exit_status) {
handle1.send(Shutdown); handle1.send(Shutdown);
@ -1095,11 +1094,13 @@ unsafe fn local_io() -> &'static mut IoFactory {
// block self on sched1 // block self on sched1
let scheduler: ~Scheduler = Local::take(); let scheduler: ~Scheduler = Local::take();
let mut tasksFriendHandle = Some(tasksFriendHandle);
scheduler.deschedule_running_task_and_then(|_, task| { scheduler.deschedule_running_task_and_then(|_, task| {
// unblock task // unblock task
task.wake().map(|task| { task.wake().map(|task| {
// send self to sched2 // 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 // sched1 should now sleep since it has nothing else to do
}) })