Skip to content

Commit a541e2d

Browse files
authored
Auto merge of #216 - Alexendoo:clone-slice-from, r=mbrubeck
Implement Clone using From This allows using the specialization in clones when it's enabled
2 parents 7a8059e + 3accaa9 commit a541e2d

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

lib.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -1563,11 +1563,7 @@ where
15631563
{
15641564
#[inline]
15651565
fn clone(&self) -> SmallVec<A> {
1566-
let mut new_vector = SmallVec::with_capacity(self.len());
1567-
for element in self.iter() {
1568-
new_vector.push((*element).clone())
1569-
}
1570-
new_vector
1566+
SmallVec::from(self.as_slice())
15711567
}
15721568
}
15731569

0 commit comments

Comments
 (0)