about summary refs log tree commit diff
path: root/library/alloc/src/vec
diff options
context:
space:
mode:
authorFrank Steffahn <frank.steffahn@stu.uni-kiel.de>2021-05-31 19:18:20 +0200
committerFrank Steffahn <frank.steffahn@stu.uni-kiel.de>2021-05-31 19:18:20 +0200
commitc902fdca459a9ee31a6ea81236cb250bc037255b (patch)
tree5c12135e65f4c6e5dc58eb7793d001523dcdf0bf /library/alloc/src/vec
parent7baa7afd0fc8061c5b815a7aab9b40d1cd406ce8 (diff)
downloadrust-c902fdca459a9ee31a6ea81236cb250bc037255b.tar.gz
rust-c902fdca459a9ee31a6ea81236cb250bc037255b.zip
Remove unnecessary SpecFromIter impls
Diffstat (limited to 'library/alloc/src/vec')
-rw-r--r--library/alloc/src/vec/spec_from_iter.rs31
1 files changed, 0 insertions, 31 deletions
diff --git a/library/alloc/src/vec/spec_from_iter.rs b/library/alloc/src/vec/spec_from_iter.rs
index bbfcc68daef..d7a957d85ff 100644
--- a/library/alloc/src/vec/spec_from_iter.rs
+++ b/library/alloc/src/vec/spec_from_iter.rs
@@ -1,6 +1,5 @@
 use core::mem::ManuallyDrop;
 use core::ptr::{self};
-use core::slice::{self};
 
 use super::{IntoIter, SpecExtend, SpecFromIterNested, Vec};
 
@@ -65,33 +64,3 @@ impl<T> SpecFromIter<T, IntoIter<T>> for Vec<T> {
         vec
     }
 }
-
-impl<'a, T: 'a, I> SpecFromIter<&'a T, I> for Vec<T>
-where
-    I: Iterator<Item = &'a T>,
-    T: Clone,
-{
-    default fn from_iter(iterator: I) -> Self {
-        SpecFromIter::from_iter(iterator.cloned())
-    }
-}
-
-// This utilizes `iterator.as_slice().to_vec()` since spec_extend
-// must take more steps to reason about the final capacity + length
-// and thus do more work. `to_vec()` directly allocates the correct amount
-// and fills it exactly.
-impl<'a, T: 'a + Clone> SpecFromIter<&'a T, slice::Iter<'a, T>> for Vec<T> {
-    #[cfg(not(test))]
-    fn from_iter(iterator: slice::Iter<'a, T>) -> Self {
-        iterator.as_slice().to_vec()
-    }
-
-    // HACK(japaric): with cfg(test) the inherent `[T]::to_vec` method, which is
-    // required for this method definition, is not available. Instead use the
-    // `slice::to_vec`  function which is only available with cfg(test)
-    // NB see the slice::hack module in slice.rs for more information
-    #[cfg(test)]
-    fn from_iter(iterator: slice::Iter<'a, T>) -> Self {
-        crate::slice::to_vec(iterator.as_slice(), crate::alloc::Global)
-    }
-}