diff options
Diffstat (limited to 'library/alloc/src')
| -rw-r--r-- | library/alloc/src/collections/binary_heap.rs | 2 | ||||
| -rw-r--r-- | library/alloc/src/collections/btree/map.rs | 8 | ||||
| -rw-r--r-- | library/alloc/src/collections/btree/set.rs | 2 | ||||
| -rw-r--r-- | library/alloc/src/collections/linked_list.rs | 2 |
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) } } |
