From 3accaa9dcbe47489d8dbc44c42eb973199948e03 Mon Sep 17 00:00:00 2001 From: Alex Macleod Date: Sat, 25 Apr 2020 16:08:27 +0100 Subject: [PATCH] Implement Clone using From This allows using the specialization in clones when it's enabled --- lib.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib.rs b/lib.rs index ba39f43..76eecc3 100644 --- a/lib.rs +++ b/lib.rs @@ -1563,11 +1563,7 @@ where { #[inline] fn clone(&self) -> SmallVec { - let mut new_vector = SmallVec::with_capacity(self.len()); - for element in self.iter() { - new_vector.push((*element).clone()) - } - new_vector + SmallVec::from(self.as_slice()) } }