@@ -102,7 +102,7 @@ use crate::raw::{Allocator, Global, RawExtractIf};
102
102
/// use hashbrown::HashSet;
103
103
///
104
104
/// let viking_names: HashSet<&'static str> =
105
- /// [ "Einar", "Olaf", "Harald" ].iter().cloned ().collect();
105
+ /// [ "Einar", "Olaf", "Harald" ].into_iter ().collect();
106
106
/// // use the values stored in the set
107
107
/// ```
108
108
///
@@ -335,7 +335,7 @@ impl<T, S, A: Allocator> HashSet<T, S, A> {
335
335
/// ```
336
336
/// use hashbrown::HashSet;
337
337
///
338
- /// let mut set: HashSet<_> = [1, 2, 3].iter().cloned ().collect();
338
+ /// let mut set: HashSet<_> = [1, 2, 3].into_iter ().collect();
339
339
/// assert!(!set.is_empty());
340
340
///
341
341
/// // print 1, 2, 3 in an arbitrary order
@@ -362,7 +362,7 @@ impl<T, S, A: Allocator> HashSet<T, S, A> {
362
362
/// use hashbrown::HashSet;
363
363
///
364
364
/// let xs = [1,2,3,4,5,6];
365
- /// let mut set: HashSet<i32> = xs.iter().cloned ().collect();
365
+ /// let mut set: HashSet<i32> = xs.into_iter ().collect();
366
366
/// set.retain(|&k| k % 2 == 0);
367
367
/// assert_eq!(set.len(), 3);
368
368
/// ```
@@ -724,8 +724,8 @@ where
724
724
///
725
725
/// ```
726
726
/// use hashbrown::HashSet;
727
- /// let a: HashSet<_> = [1, 2, 3].iter().cloned ().collect();
728
- /// let b: HashSet<_> = [4, 2, 3, 4].iter().cloned ().collect();
727
+ /// let a: HashSet<_> = [1, 2, 3].into_iter ().collect();
728
+ /// let b: HashSet<_> = [4, 2, 3, 4].into_iter ().collect();
729
729
///
730
730
/// // Can be seen as `a - b`.
731
731
/// for x in a.difference(&b) {
@@ -755,8 +755,8 @@ where
755
755
///
756
756
/// ```
757
757
/// use hashbrown::HashSet;
758
- /// let a: HashSet<_> = [1, 2, 3].iter().cloned ().collect();
759
- /// let b: HashSet<_> = [4, 2, 3, 4].iter().cloned ().collect();
758
+ /// let a: HashSet<_> = [1, 2, 3].into_iter ().collect();
759
+ /// let b: HashSet<_> = [4, 2, 3, 4].into_iter ().collect();
760
760
///
761
761
/// // Print 1, 4 in arbitrary order.
762
762
/// for x in a.symmetric_difference(&b) {
@@ -783,8 +783,8 @@ where
783
783
///
784
784
/// ```
785
785
/// use hashbrown::HashSet;
786
- /// let a: HashSet<_> = [1, 2, 3].iter().cloned ().collect();
787
- /// let b: HashSet<_> = [4, 2, 3, 4].iter().cloned ().collect();
786
+ /// let a: HashSet<_> = [1, 2, 3].into_iter ().collect();
787
+ /// let b: HashSet<_> = [4, 2, 3, 4].into_iter ().collect();
788
788
///
789
789
/// // Print 2, 3 in arbitrary order.
790
790
/// for x in a.intersection(&b) {
@@ -814,8 +814,8 @@ where
814
814
///
815
815
/// ```
816
816
/// use hashbrown::HashSet;
817
- /// let a: HashSet<_> = [1, 2, 3].iter().cloned ().collect();
818
- /// let b: HashSet<_> = [4, 2, 3, 4].iter().cloned ().collect();
817
+ /// let a: HashSet<_> = [1, 2, 3].into_iter ().collect();
818
+ /// let b: HashSet<_> = [4, 2, 3, 4].into_iter ().collect();
819
819
///
820
820
/// // Print 1, 2, 3, 4 in arbitrary order.
821
821
/// for x in a.union(&b) {
@@ -850,7 +850,7 @@ where
850
850
/// ```
851
851
/// use hashbrown::HashSet;
852
852
///
853
- /// let set: HashSet<_> = [1, 2, 3].iter().cloned ().collect();
853
+ /// let set: HashSet<_> = [1, 2, 3].into_iter ().collect();
854
854
/// assert_eq!(set.contains(&1), true);
855
855
/// assert_eq!(set.contains(&4), false);
856
856
/// ```
@@ -876,7 +876,7 @@ where
876
876
/// ```
877
877
/// use hashbrown::HashSet;
878
878
///
879
- /// let set: HashSet<_> = [1, 2, 3].iter().cloned ().collect();
879
+ /// let set: HashSet<_> = [1, 2, 3].into_iter ().collect();
880
880
/// assert_eq!(set.get(&2), Some(&2));
881
881
/// assert_eq!(set.get(&4), None);
882
882
/// ```
@@ -903,7 +903,7 @@ where
903
903
/// ```
904
904
/// use hashbrown::HashSet;
905
905
///
906
- /// let mut set: HashSet<_> = [1, 2, 3].iter().cloned ().collect();
906
+ /// let mut set: HashSet<_> = [1, 2, 3].into_iter ().collect();
907
907
/// assert_eq!(set.len(), 3);
908
908
/// assert_eq!(set.get_or_insert(2), &2);
909
909
/// assert_eq!(set.get_or_insert(100), &100);
@@ -1034,7 +1034,7 @@ where
1034
1034
/// ```
1035
1035
/// use hashbrown::HashSet;
1036
1036
///
1037
- /// let a: HashSet<_> = [1, 2, 3].iter().cloned ().collect();
1037
+ /// let a: HashSet<_> = [1, 2, 3].into_iter ().collect();
1038
1038
/// let mut b = HashSet::new();
1039
1039
///
1040
1040
/// assert_eq!(a.is_disjoint(&b), true);
@@ -1055,7 +1055,7 @@ where
1055
1055
/// ```
1056
1056
/// use hashbrown::HashSet;
1057
1057
///
1058
- /// let sup: HashSet<_> = [1, 2, 3].iter().cloned ().collect();
1058
+ /// let sup: HashSet<_> = [1, 2, 3].into_iter ().collect();
1059
1059
/// let mut set = HashSet::new();
1060
1060
///
1061
1061
/// assert_eq!(set.is_subset(&sup), true);
@@ -1076,7 +1076,7 @@ where
1076
1076
/// ```
1077
1077
/// use hashbrown::HashSet;
1078
1078
///
1079
- /// let sub: HashSet<_> = [1, 2].iter().cloned ().collect();
1079
+ /// let sub: HashSet<_> = [1, 2].into_iter ().collect();
1080
1080
/// let mut set = HashSet::new();
1081
1081
///
1082
1082
/// assert_eq!(set.is_superset(&sub), false);
@@ -1205,7 +1205,7 @@ where
1205
1205
/// ```
1206
1206
/// use hashbrown::HashSet;
1207
1207
///
1208
- /// let mut set: HashSet<_> = [1, 2, 3].iter().cloned ().collect();
1208
+ /// let mut set: HashSet<_> = [1, 2, 3].into_iter ().collect();
1209
1209
/// assert_eq!(set.take(&2), Some(2));
1210
1210
/// assert_eq!(set.take(&2), None);
1211
1211
/// ```
0 commit comments