diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index 3ed9c154e47..8e877542746 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -1479,22 +1479,15 @@ fn extend_desugared>(&mut self, mut iterator: I) { // for item in iterator { // self.push(item); // } - loop { - match iterator.next() { - None => { - break; - } - Some(element) => { - let len = self.len(); - if len == self.capacity() { - let (lower, _) = iterator.size_hint(); - self.reserve(lower + 1); - } - unsafe { - ptr::write(self.get_unchecked_mut(len), element); - self.set_len(len + 1); - } - } + while let Some(element) = iterator.next() { + let len = self.len(); + if len == self.capacity() { + let (lower, _) = iterator.size_hint(); + self.reserve(lower + 1); + } + unsafe { + ptr::write(self.get_unchecked_mut(len), element); + self.set_len(len + 1); } } }