about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-05-24 02:04:47 -0700
committerbors <bors@rust-lang.org>2013-05-24 02:04:47 -0700
commit2f69bb9ba9d622ccab77840c08f4562a10b44c29 (patch)
treebbd6c5b557e45f84741cbce2b05b5b59faa4e55b
parent5787bf3093e75aa28fb081160f7d7fa66f528f9c (diff)
parent0629ef16e8d93e7e461b025e829b350b5daeed6a (diff)
downloadrust-2f69bb9ba9d622ccab77840c08f4562a10b44c29.tar.gz
rust-2f69bb9ba9d622ccab77840c08f4562a10b44c29.zip
auto merge of #6712 : thestinger/rust/derive, r=catamorphism
-rw-r--r--src/libstd/cell.rs15
-rw-r--r--src/libstd/option.rs11
2 files changed, 2 insertions, 24 deletions
diff --git a/src/libstd/cell.rs b/src/libstd/cell.rs
index b707e3bbb9e..d1fa9e697bf 100644
--- a/src/libstd/cell.rs
+++ b/src/libstd/cell.rs
@@ -21,24 +21,11 @@ Similar to a mutable option type, but friendlier.
 */
 
 #[mutable]
-#[deriving(Clone)]
+#[deriving(Clone, DeepClone, Eq)]
 pub struct Cell<T> {
     priv value: Option<T>
 }
 
-impl<T: DeepClone> DeepClone for Cell<T> {
-    fn deep_clone(&self) -> Cell<T> {
-        Cell{value: self.value.deep_clone()}
-    }
-}
-
-impl<T:cmp::Eq> cmp::Eq for Cell<T> {
-    fn eq(&self, other: &Cell<T>) -> bool {
-        (self.value) == (other.value)
-    }
-    fn ne(&self, other: &Cell<T>) -> bool { !self.eq(other) }
-}
-
 /// Creates a new full cell with the given value.
 pub fn Cell<T>(value: T) -> Cell<T> {
     Cell { value: Some(value) }
diff --git a/src/libstd/option.rs b/src/libstd/option.rs
index bc1ffcdc81a..be6ec8c8518 100644
--- a/src/libstd/option.rs
+++ b/src/libstd/option.rs
@@ -54,21 +54,12 @@ use clone::DeepClone;
 #[cfg(test)] use str;
 
 /// The option type
-#[deriving(Clone, Eq)]
+#[deriving(Clone, DeepClone, Eq)]
 pub enum Option<T> {
     None,
     Some(T),
 }
 
-impl<T: DeepClone> DeepClone for Option<T> {
-    fn deep_clone(&self) -> Option<T> {
-        match *self {
-            Some(ref x) => Some(x.deep_clone()),
-            None => None
-        }
-    }
-}
-
 impl<T:Ord> Ord for Option<T> {
     fn lt(&self, other: &Option<T>) -> bool {
         match (self, other) {