From eb802f4f44e6de1b552ec4aaa689466186a0fff2 Mon Sep 17 00:00:00 2001 From: Andrew Paseltiner <apaseltiner@gmail.com> Date: Sat, 11 Jul 2015 13:37:45 -0400 Subject: [PATCH] derive `Clone` impl --- src/lib.rs | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 1441d36..a2ac460 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -59,6 +59,7 @@ use std::vec; /// months.clear(); /// assert!(months.is_empty()); /// ``` +#[derive(Clone)] pub struct VecMap<V> { v: Vec<Option<V>>, } @@ -91,18 +92,6 @@ impl<V> Default for VecMap<V> { fn default() -> VecMap<V> { VecMap::new() } } -impl<V:Clone> Clone for VecMap<V> { - #[inline] - fn clone(&self) -> VecMap<V> { - VecMap { v: self.v.clone() } - } - - #[inline] - fn clone_from(&mut self, source: &VecMap<V>) { - self.v.clone_from(&source.v); - } -} - impl<V: Hash> Hash for VecMap<V> { fn hash<H: Hasher>(&self, state: &mut H) { // In order to not traverse the `VecMap` twice, count the elements -- GitLab