about summary refs log tree commit diff
path: root/src/libsyntax/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsyntax/util')
-rw-r--r--src/libsyntax/util/small_vector.rs10
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);
         }
     }