|
3 | 3 |
|
4 | 4 | mod core; |
5 | 5 |
|
6 | | -#[cfg(not(has_std))] |
7 | | -use std::vec::Vec; |
8 | | - |
9 | 6 | pub use mutable_keys::MutableKeys; |
10 | 7 |
|
11 | 8 | #[cfg(feature = "rayon")] |
12 | 9 | pub use rayon::map as rayon; |
13 | 10 |
|
14 | | -use std::hash::BuildHasher; |
15 | | -use std::hash::Hash; |
16 | | -use std::hash::Hasher; |
17 | | -use std::iter::FromIterator; |
18 | | -use std::ops::RangeFull; |
| 11 | +use core::cmp::Ordering; |
| 12 | +use core::fmt; |
| 13 | +use core::hash::{BuildHasher, Hash, Hasher}; |
| 14 | +use core::iter::FromIterator; |
| 15 | +use core::ops::{Index, IndexMut, RangeFull}; |
| 16 | +use core::slice::{Iter as SliceIter, IterMut as SliceIterMut}; |
| 17 | +use vec::{self, Vec}; |
19 | 18 |
|
20 | 19 | #[cfg(has_std)] |
21 | 20 | use std::collections::hash_map::RandomState; |
22 | 21 |
|
23 | | -use std::cmp::Ordering; |
24 | | -use std::fmt; |
25 | | - |
26 | 22 | use self::core::IndexMapCore; |
27 | 23 | use equivalent::Equivalent; |
28 | 24 | use util::third; |
@@ -720,10 +716,6 @@ impl<K, V, S> IndexMap<K, V, S> { |
720 | 716 | } |
721 | 717 | } |
722 | 718 |
|
723 | | -use std::slice::Iter as SliceIter; |
724 | | -use std::slice::IterMut as SliceIterMut; |
725 | | -use std::vec::IntoIter as VecIntoIter; |
726 | | - |
727 | 719 | /// An iterator over the keys of a `IndexMap`. |
728 | 720 | /// |
729 | 721 | /// This `struct` is created by the [`keys`] method on [`IndexMap`]. See its |
@@ -922,7 +914,7 @@ impl<'a, K, V> ExactSizeIterator for IterMut<'a, K, V> { |
922 | 914 | /// [`into_iter`]: struct.IndexMap.html#method.into_iter |
923 | 915 | /// [`IndexMap`]: struct.IndexMap.html |
924 | 916 | pub struct IntoIter<K, V> { |
925 | | - pub(crate) iter: VecIntoIter<Bucket<K, V>>, |
| 917 | + pub(crate) iter: vec::IntoIter<Bucket<K, V>>, |
926 | 918 | } |
927 | 919 |
|
928 | 920 | impl<K, V> Iterator for IntoIter<K, V> { |
@@ -962,7 +954,7 @@ where |
962 | 954 | K: 'a, |
963 | 955 | V: 'a, |
964 | 956 | { |
965 | | - pub(crate) iter: ::std::vec::Drain<'a, Bucket<K, V>>, |
| 957 | + pub(crate) iter: vec::Drain<'a, Bucket<K, V>>, |
966 | 958 | } |
967 | 959 |
|
968 | 960 | impl<'a, K, V> Iterator for Drain<'a, K, V> { |
@@ -1013,8 +1005,6 @@ where |
1013 | 1005 | } |
1014 | 1006 | } |
1015 | 1007 |
|
1016 | | -use std::ops::{Index, IndexMut}; |
1017 | | - |
1018 | 1008 | impl<'a, K, V, Q: ?Sized, S> Index<&'a Q> for IndexMap<K, V, S> |
1019 | 1009 | where |
1020 | 1010 | Q: Hash + Equivalent<K>, |
@@ -1149,6 +1139,7 @@ where |
1149 | 1139 | #[cfg(test)] |
1150 | 1140 | mod tests { |
1151 | 1141 | use super::*; |
| 1142 | + use std::string::String; |
1152 | 1143 | use util::enumerate; |
1153 | 1144 |
|
1154 | 1145 | #[test] |
@@ -1405,8 +1396,7 @@ mod tests { |
1405 | 1396 | map_b.swap_remove(&1); |
1406 | 1397 | assert_ne!(map_a, map_b); |
1407 | 1398 |
|
1408 | | - let map_c: IndexMap<_, String> = |
1409 | | - map_b.into_iter().map(|(k, v)| (k, v.to_owned())).collect(); |
| 1399 | + let map_c: IndexMap<_, String> = map_b.into_iter().map(|(k, v)| (k, v.into())).collect(); |
1410 | 1400 | assert_ne!(map_a, map_c); |
1411 | 1401 | assert_ne!(map_c, map_a); |
1412 | 1402 | } |
|
0 commit comments