diff options
| author | Nathan West <Lucretiel@users.noreply.github.com> | 2018-10-02 12:35:25 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-10-02 12:35:25 -0700 |
| commit | ec59188025582fd91ab868206cfb3f3f05e27ade (patch) | |
| tree | ed8bbea6ebaa7acbc48b60c78766562d73a77636 /src/liballoc | |
| parent | 1c5e9c68ea6c76fe400528de17ebe03e338bac68 (diff) | |
| download | rust-ec59188025582fd91ab868206cfb3f3f05e27ade.tar.gz rust-ec59188025582fd91ab868206cfb3f3f05e27ade.zip | |
Make spec_extend use for_each()
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/vec.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs index e845438c0a8..2bc037e3fee 100644 --- a/src/liballoc/vec.rs +++ b/src/liballoc/vec.rs @@ -1822,12 +1822,12 @@ impl<T, I> SpecExtend<T, I> for Vec<T> unsafe { let mut ptr = self.as_mut_ptr().add(self.len()); let mut local_len = SetLenOnDrop::new(&mut self.len); - for element in iterator { + iterator.for_each(move |element| { ptr::write(ptr, element); ptr = ptr.offset(1); // NB can't overflow since we would have had to alloc the address space local_len.increment_len(1); - } + }); } } else { self.extend_desugared(iterator) |
