Skip to content

Commit

Permalink
Smarter CVec::collect() #14
Browse files Browse the repository at this point in the history
  • Loading branch information
aeplay committed Nov 21, 2016
1 parent 4ba8980 commit 0b14d95
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/kay/src/compact_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,9 @@ impl<T: Copy, A: Allocator> Clone for CompactVec<T, A> {

impl<T: Compact + Clone, A: Allocator> FromIterator<T> for CompactVec<T, A> {
fn from_iter<I: IntoIterator<Item=T>>(iter: I) -> Self {
let mut vec = CompactVec::new();
for item in iter {
let into_iter = iter.into_iter();
let mut vec = CompactVec::with_capacity(into_iter.size_hint().0);
for item in into_iter {
vec.push(item);
}
vec
Expand Down

0 comments on commit 0b14d95

Please sign in to comment.