diff options
| author | Marvin Löbel <loebel.marvin@gmail.com> | 2014-03-20 14:12:56 +0100 |
|---|---|---|
| committer | Marvin Löbel <loebel.marvin@gmail.com> | 2014-03-25 21:49:55 +0100 |
| commit | 6200e761f0ef58510ad2acc383b29de7e7a79bcd (patch) | |
| tree | 4eb8bee6a91f0d8cbc79b33506344a56f1891e5d /src/libsyntax/util | |
| parent | 1f5571abc222520537daa00fc8256040647eec86 (diff) | |
| download | rust-6200e761f0ef58510ad2acc383b29de7e7a79bcd.tar.gz rust-6200e761f0ef58510ad2acc383b29de7e7a79bcd.zip | |
Changed `iter::Extendable` and `iter::FromIterator` to take a `Iterator` by value
Diffstat (limited to 'src/libsyntax/util')
| -rw-r--r-- | src/libsyntax/util/small_vector.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/libsyntax/util/small_vector.rs b/src/libsyntax/util/small_vector.rs index ac2b00bed76..9d6295e3f28 100644 --- a/src/libsyntax/util/small_vector.rs +++ b/src/libsyntax/util/small_vector.rs @@ -29,18 +29,16 @@ impl<T> Container for SmallVector<T> { } impl<T> FromIterator<T> for SmallVector<T> { - fn from_iterator<I: Iterator<T>>(iter: &mut I) -> SmallVector<T> { + fn from_iterator<I: Iterator<T>>(iter: I) -> SmallVector<T> { let mut v = Zero; - for val in *iter { - v.push(val); - } + v.extend(iter); v } } impl<T> Extendable<T> for SmallVector<T> { - fn extend<I: Iterator<T>>(&mut self, iter: &mut I) { - for val in *iter { + fn extend<I: Iterator<T>>(&mut self, mut iter: I) { + for val in iter { self.push(val); } } |
