Simplify RootCollection::unroot a bit.

This commit is contained in:
Ms2ger 2015-02-23 22:46:41 +01:00
parent 91abf5557b
commit 601e80fa43

View file

@ -634,11 +634,9 @@ impl RootCollection {
fn unroot<'b, T: Reflectable>(&self, rooted: &Root<T>) {
unsafe {
let roots = self.roots.get();
debug!("unrooting {:?} (expecting {:?}",
(*roots).as_slice().last().unwrap(),
rooted.js_ptr);
assert!(*(*roots).as_slice().last().unwrap() == rooted.js_ptr);
(*roots).pop().unwrap();
let unrooted = (*roots).pop().unwrap();
debug!("unrooted {:?} (expecting {:?}", unrooted, rooted.js_ptr);
assert!(unrooted == rooted.js_ptr);
}
}
}