about summary refs log tree commit diff
path: root/library/alloc/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-12-05 12:53:01 +0000
committerbors <bors@rust-lang.org>2021-12-05 12:53:01 +0000
commit1597728ef5820d3ffcb9d3f0c890ef7802398751 (patch)
tree1a86c2a2cb56d502776e6cc3936ec683efb62ffb /library/alloc/src
parentcafc4582e66c478b6b297ae85b225c788106015e (diff)
parent27d39357b7052d96e1b3903518841d14534c38cf (diff)
downloadrust-1597728ef5820d3ffcb9d3f0c890ef7802398751.tar.gz
rust-1597728ef5820d3ffcb9d3f0c890ef7802398751.zip
Auto merge of #88611 - m-ou-se:array-into-iter-new-deprecate, r=joshtriplett
Deprecate array::IntoIter::new.
Diffstat (limited to 'library/alloc/src')
-rw-r--r--library/alloc/src/collections/binary_heap.rs2
-rw-r--r--library/alloc/src/collections/btree/map.rs8
-rw-r--r--library/alloc/src/collections/btree/set.rs2
-rw-r--r--library/alloc/src/collections/linked_list.rs2
4 files changed, 7 insertions, 7 deletions
diff --git a/library/alloc/src/collections/binary_heap.rs b/library/alloc/src/collections/binary_heap.rs
index 7d87974b47e..76fbfa9fc59 100644
--- a/library/alloc/src/collections/binary_heap.rs
+++ b/library/alloc/src/collections/binary_heap.rs
@@ -1500,7 +1500,7 @@ impl<T: Ord, const N: usize> From<[T; N]> for BinaryHeap<T> {
     /// }
     /// ```
     fn from(arr: [T; N]) -> Self {
-        core::array::IntoIter::new(arr).collect()
+        Self::from_iter(arr)
     }
 }
 
diff --git a/library/alloc/src/collections/btree/map.rs b/library/alloc/src/collections/btree/map.rs
index 2ff7b0fbb75..3bd5b8ddf08 100644
--- a/library/alloc/src/collections/btree/map.rs
+++ b/library/alloc/src/collections/btree/map.rs
@@ -1305,11 +1305,11 @@ impl<K, V> BTreeMap<K, V> {
     pub(crate) fn bulk_build_from_sorted_iter<I>(iter: I) -> Self
     where
         K: Ord,
-        I: Iterator<Item = (K, V)>,
+        I: IntoIterator<Item = (K, V)>,
     {
         let mut root = Root::new();
         let mut length = 0;
-        root.bulk_push(DedupSortedIter::new(iter), &mut length);
+        root.bulk_push(DedupSortedIter::new(iter.into_iter()), &mut length);
         BTreeMap { root: Some(root), length }
     }
 }
@@ -1944,7 +1944,7 @@ impl<K: Ord, V> FromIterator<(K, V)> for BTreeMap<K, V> {
 
         // use stable sort to preserve the insertion order.
         inputs.sort_by(|a, b| a.0.cmp(&b.0));
-        BTreeMap::bulk_build_from_sorted_iter(inputs.into_iter())
+        BTreeMap::bulk_build_from_sorted_iter(inputs)
     }
 }
 
@@ -2061,7 +2061,7 @@ impl<K: Ord, V, const N: usize> From<[(K, V); N]> for BTreeMap<K, V> {
 
         // use stable sort to preserve the insertion order.
         arr.sort_by(|a, b| a.0.cmp(&b.0));
-        BTreeMap::bulk_build_from_sorted_iter(core::array::IntoIter::new(arr))
+        BTreeMap::bulk_build_from_sorted_iter(arr)
     }
 }
 
diff --git a/library/alloc/src/collections/btree/set.rs b/library/alloc/src/collections/btree/set.rs
index 0322cabccde..4a83cdb917c 100644
--- a/library/alloc/src/collections/btree/set.rs
+++ b/library/alloc/src/collections/btree/set.rs
@@ -1106,7 +1106,7 @@ impl<T: Ord, const N: usize> From<[T; N]> for BTreeSet<T> {
 
         // use stable sort to preserve the insertion order.
         arr.sort();
-        let iter = core::array::IntoIter::new(arr).map(|k| (k, ()));
+        let iter = IntoIterator::into_iter(arr).map(|k| (k, ()));
         let map = BTreeMap::bulk_build_from_sorted_iter(iter);
         BTreeSet { map }
     }
diff --git a/library/alloc/src/collections/linked_list.rs b/library/alloc/src/collections/linked_list.rs
index e4913b16adb..c8aad4877e9 100644
--- a/library/alloc/src/collections/linked_list.rs
+++ b/library/alloc/src/collections/linked_list.rs
@@ -1961,7 +1961,7 @@ impl<T, const N: usize> From<[T; N]> for LinkedList<T> {
     /// assert_eq!(list1, list2);
     /// ```
     fn from(arr: [T; N]) -> Self {
-        core::array::IntoIter::new(arr).collect()
+        Self::from_iter(arr)
     }
 }