Remove redundant extension trait
It turns out that `Cell<T>` already has a `take` method that leaves the default
in its place. And for `Option<T>` the default is `None`, so it does exactly what
we want already.
commit46d0ccc4e0697a80aba772a9fc0f28c3dcd1d625
authorNick Fitzgerald <fitzgen@gmail.com>
dateTue 12 Feb 2019, 06:24 (8 years ago)
parentaf5ae1a
src/vdom.rs−12
@@ -493,18 +493,6 @@ where
493493 *h.borrow_mut() = Some(f);
494494}
495495
496−trait CellOptionExt<T> {
497− fn take(&self) -> Option<T>;
498−}
499−
500−impl<T> CellOptionExt<T> for Cell<Option<T>> {
501− fn take(&self) -> Option<T> {
502− let temp = Cell::new(None);
503− self.swap(&temp);
504− temp.into_inner()
505− }
506−}
507−
508496/// An operation failed because the virtual DOM was already dropped and
509497/// unmounted.
510498#[derive(Debug)]