|
1 | 1 | use core::mem::ManuallyDrop; |
2 | 2 | use core::ptr::{self}; |
3 | | -use core::slice::{self}; |
4 | 3 |
|
5 | 4 | use super::{IntoIter, SpecExtend, SpecFromIterNested, Vec}; |
6 | 5 |
|
@@ -65,33 +64,3 @@ impl<T> SpecFromIter<T, IntoIter<T>> for Vec<T> { |
65 | 64 | vec |
66 | 65 | } |
67 | 66 | } |
68 | | - |
69 | | -impl<'a, T: 'a, I> SpecFromIter<&'a T, I> for Vec<T> |
70 | | -where |
71 | | - I: Iterator<Item = &'a T>, |
72 | | - T: Clone, |
73 | | -{ |
74 | | - default fn from_iter(iterator: I) -> Self { |
75 | | - SpecFromIter::from_iter(iterator.cloned()) |
76 | | - } |
77 | | -} |
78 | | - |
79 | | -// This utilizes `iterator.as_slice().to_vec()` since spec_extend |
80 | | -// must take more steps to reason about the final capacity + length |
81 | | -// and thus do more work. `to_vec()` directly allocates the correct amount |
82 | | -// and fills it exactly. |
83 | | -impl<'a, T: 'a + Clone> SpecFromIter<&'a T, slice::Iter<'a, T>> for Vec<T> { |
84 | | - #[cfg(not(test))] |
85 | | - fn from_iter(iterator: slice::Iter<'a, T>) -> Self { |
86 | | - iterator.as_slice().to_vec() |
87 | | - } |
88 | | - |
89 | | - // HACK(japaric): with cfg(test) the inherent `[T]::to_vec` method, which is |
90 | | - // required for this method definition, is not available. Instead use the |
91 | | - // `slice::to_vec` function which is only available with cfg(test) |
92 | | - // NB see the slice::hack module in slice.rs for more information |
93 | | - #[cfg(test)] |
94 | | - fn from_iter(iterator: slice::Iter<'a, T>) -> Self { |
95 | | - crate::slice::to_vec(iterator.as_slice(), crate::alloc::Global) |
96 | | - } |
97 | | -} |
0 commit comments