@@ -233,7 +233,7 @@ impl<T, S> HashSet<T, S> {
233233     /// ``` 
234234     /// use std::collections::HashSet; 
235235     /// 
236-      /// let mut set: HashSet<_> =  [1, 2, 3].iter().cloned().collect( ); 
236+      /// let mut set = HashSet::from( [1, 2, 3]); 
237237     /// assert!(!set.is_empty()); 
238238     /// 
239239     /// // print 1, 2, 3 in an arbitrary order 
@@ -489,8 +489,8 @@ where
489489     /// 
490490     /// ``` 
491491     /// use std::collections::HashSet; 
492-      /// let a: HashSet<_> =  [1, 2, 3].iter().cloned().collect( ); 
493-      /// let b: HashSet<_> =  [4, 2, 3, 4].iter().cloned().collect( ); 
492+      /// let a = HashSet::from( [1, 2, 3]); 
493+      /// let b = HashSet::from( [4, 2, 3, 4]); 
494494     /// 
495495     /// // Can be seen as `a - b`. 
496496     /// for x in a.difference(&b) { 
@@ -518,8 +518,8 @@ where
518518     /// 
519519     /// ``` 
520520     /// use std::collections::HashSet; 
521-      /// let a: HashSet<_> =  [1, 2, 3].iter().cloned().collect( ); 
522-      /// let b: HashSet<_> =  [4, 2, 3, 4].iter().cloned().collect( ); 
521+      /// let a = HashSet::from( [1, 2, 3]); 
522+      /// let b = HashSet::from( [4, 2, 3, 4]); 
523523     /// 
524524     /// // Print 1, 4 in arbitrary order. 
525525     /// for x in a.symmetric_difference(&b) { 
@@ -548,8 +548,8 @@ where
548548     /// 
549549     /// ``` 
550550     /// use std::collections::HashSet; 
551-      /// let a: HashSet<_> =  [1, 2, 3].iter().cloned().collect( ); 
552-      /// let b: HashSet<_> =  [4, 2, 3, 4].iter().cloned().collect( ); 
551+      /// let a = HashSet::from( [1, 2, 3]); 
552+      /// let b = HashSet::from( [4, 2, 3, 4]); 
553553     /// 
554554     /// // Print 2, 3 in arbitrary order. 
555555     /// for x in a.intersection(&b) { 
@@ -576,8 +576,8 @@ where
576576     /// 
577577     /// ``` 
578578     /// use std::collections::HashSet; 
579-      /// let a: HashSet<_> =  [1, 2, 3].iter().cloned().collect( ); 
580-      /// let b: HashSet<_> =  [4, 2, 3, 4].iter().cloned().collect( ); 
579+      /// let a = HashSet::from( [1, 2, 3]); 
580+      /// let b = HashSet::from( [4, 2, 3, 4]); 
581581     /// 
582582     /// // Print 1, 2, 3, 4 in arbitrary order. 
583583     /// for x in a.union(&b) { 
@@ -608,7 +608,7 @@ where
608608     /// ``` 
609609     /// use std::collections::HashSet; 
610610     /// 
611-      /// let set: HashSet<_> =  [1, 2, 3].iter().cloned().collect( ); 
611+      /// let set = HashSet::from( [1, 2, 3]); 
612612     /// assert_eq!(set.contains(&1), true); 
613613     /// assert_eq!(set.contains(&4), false); 
614614     /// ``` 
@@ -633,7 +633,7 @@ where
633633     /// ``` 
634634     /// use std::collections::HashSet; 
635635     /// 
636-      /// let set: HashSet<_> =  [1, 2, 3].iter().cloned().collect( ); 
636+      /// let set = HashSet::from( [1, 2, 3]); 
637637     /// assert_eq!(set.get(&2), Some(&2)); 
638638     /// assert_eq!(set.get(&4), None); 
639639     /// ``` 
@@ -657,7 +657,7 @@ where
657657     /// 
658658     /// use std::collections::HashSet; 
659659     /// 
660-      /// let mut set: HashSet<_> =  [1, 2, 3].iter().cloned().collect( ); 
660+      /// let mut set = HashSet::from( [1, 2, 3]); 
661661     /// assert_eq!(set.len(), 3); 
662662     /// assert_eq!(set.get_or_insert(2), &2); 
663663     /// assert_eq!(set.get_or_insert(100), &100); 
@@ -744,7 +744,7 @@ where
744744     /// ``` 
745745     /// use std::collections::HashSet; 
746746     /// 
747-      /// let a: HashSet<_> =  [1, 2, 3].iter().cloned().collect( ); 
747+      /// let a = HashSet::from( [1, 2, 3]); 
748748     /// let mut b = HashSet::new(); 
749749     /// 
750750     /// assert_eq!(a.is_disjoint(&b), true); 
@@ -770,7 +770,7 @@ where
770770     /// ``` 
771771     /// use std::collections::HashSet; 
772772     /// 
773-      /// let sup: HashSet<_> =  [1, 2, 3].iter().cloned().collect( ); 
773+      /// let sup = HashSet::from( [1, 2, 3]); 
774774     /// let mut set = HashSet::new(); 
775775     /// 
776776     /// assert_eq!(set.is_subset(&sup), true); 
@@ -792,7 +792,7 @@ where
792792     /// ``` 
793793     /// use std::collections::HashSet; 
794794     /// 
795-      /// let sub: HashSet<_> =  [1, 2].iter().cloned().collect( ); 
795+      /// let sub = HashSet::from( [1, 2]); 
796796     /// let mut set = HashSet::new(); 
797797     /// 
798798     /// assert_eq!(set.is_superset(&sub), false); 
@@ -893,7 +893,7 @@ where
893893     /// ``` 
894894     /// use std::collections::HashSet; 
895895     /// 
896-      /// let mut set: HashSet<_> =  [1, 2, 3].iter().cloned().collect( ); 
896+      /// let mut set = HashSet::from( [1, 2, 3]); 
897897     /// assert_eq!(set.take(&2), Some(2)); 
898898     /// assert_eq!(set.take(&2), None); 
899899     /// ``` 
@@ -917,8 +917,7 @@ where
917917     /// ``` 
918918     /// use std::collections::HashSet; 
919919     /// 
920-      /// let xs = [1, 2, 3, 4, 5, 6]; 
921-      /// let mut set: HashSet<i32> = xs.iter().cloned().collect(); 
920+      /// let mut set = HashSet::from([1, 2, 3, 4, 5, 6]); 
922921     /// set.retain(|&k| k % 2 == 0); 
923922     /// assert_eq!(set.len(), 3); 
924923     /// ``` 
@@ -1097,8 +1096,8 @@ where
10971096     /// ``` 
10981097     /// use std::collections::HashSet; 
10991098     /// 
1100-      /// let a: HashSet<_> = vec! [1, 2, 3].into_iter().collect( ); 
1101-      /// let b: HashSet<_> = vec! [3, 4, 5].into_iter().collect( ); 
1099+      /// let a = HashSet::from( [1, 2, 3]); 
1100+      /// let b = HashSet::from( [3, 4, 5]); 
11021101     /// 
11031102     /// let set = &a | &b; 
11041103     /// 
@@ -1130,8 +1129,8 @@ where
11301129     /// ``` 
11311130     /// use std::collections::HashSet; 
11321131     /// 
1133-      /// let a: HashSet<_> = vec! [1, 2, 3].into_iter().collect( ); 
1134-      /// let b: HashSet<_> = vec! [2, 3, 4].into_iter().collect( ); 
1132+      /// let a = HashSet::from( [1, 2, 3]); 
1133+      /// let b = HashSet::from( [2, 3, 4]); 
11351134     /// 
11361135     /// let set = &a & &b; 
11371136     /// 
@@ -1163,8 +1162,8 @@ where
11631162     /// ``` 
11641163     /// use std::collections::HashSet; 
11651164     /// 
1166-      /// let a: HashSet<_> = vec! [1, 2, 3].into_iter().collect( ); 
1167-      /// let b: HashSet<_> = vec! [3, 4, 5].into_iter().collect( ); 
1165+      /// let a = HashSet::from( [1, 2, 3]); 
1166+      /// let b = HashSet::from( [3, 4, 5]); 
11681167     /// 
11691168     /// let set = &a ^ &b; 
11701169     /// 
@@ -1196,8 +1195,8 @@ where
11961195     /// ``` 
11971196     /// use std::collections::HashSet; 
11981197     /// 
1199-      /// let a: HashSet<_> = vec! [1, 2, 3].into_iter().collect( ); 
1200-      /// let b: HashSet<_> = vec! [3, 4, 5].into_iter().collect( ); 
1198+      /// let a = HashSet::from( [1, 2, 3]); 
1199+      /// let b = HashSet::from( [3, 4, 5]); 
12011200     /// 
12021201     /// let set = &a - &b; 
12031202     /// 
@@ -1226,7 +1225,7 @@ where
12261225/// ``` 
12271226/// use std::collections::HashSet; 
12281227/// 
1229- /// let a: HashSet<u32> = vec! [1, 2, 3].into_iter().collect( ); 
1228+ /// let a = HashSet::from( [1, 2, 3]); 
12301229/// 
12311230/// let mut iter = a.iter(); 
12321231/// ``` 
@@ -1248,7 +1247,7 @@ pub struct Iter<'a, K: 'a> {
12481247/// ``` 
12491248/// use std::collections::HashSet; 
12501249/// 
1251- /// let a: HashSet<u32> = vec! [1, 2, 3].into_iter().collect( ); 
1250+ /// let a = HashSet::from( [1, 2, 3]); 
12521251/// 
12531252/// let mut iter = a.into_iter(); 
12541253/// ``` 
@@ -1269,7 +1268,7 @@ pub struct IntoIter<K> {
12691268/// ``` 
12701269/// use std::collections::HashSet; 
12711270/// 
1272- /// let mut a: HashSet<u32> = vec! [1, 2, 3].into_iter().collect( ); 
1271+ /// let mut a = HashSet::from( [1, 2, 3]); 
12731272/// 
12741273/// let mut drain = a.drain(); 
12751274/// ``` 
@@ -1291,7 +1290,7 @@ pub struct Drain<'a, K: 'a> {
12911290/// 
12921291/// use std::collections::HashSet; 
12931292/// 
1294- /// let mut a: HashSet<u32> = vec! [1, 2, 3].into_iter().collect( ); 
1293+ /// let mut a = HashSet::from( [1, 2, 3]); 
12951294/// 
12961295/// let mut drain_filtered = a.drain_filter(|v| v % 2 == 0); 
12971296/// ``` 
@@ -1315,8 +1314,8 @@ where
13151314/// ``` 
13161315/// use std::collections::HashSet; 
13171316/// 
1318- /// let a: HashSet<u32> = vec! [1, 2, 3].into_iter().collect( ); 
1319- /// let b: HashSet<_> =  [4, 2, 3, 4].iter().cloned().collect( ); 
1317+ /// let a = HashSet::from( [1, 2, 3]); 
1318+ /// let b = HashSet::from( [4, 2, 3, 4]); 
13201319/// 
13211320/// let mut intersection = a.intersection(&b); 
13221321/// ``` 
@@ -1342,8 +1341,8 @@ pub struct Intersection<'a, T: 'a, S: 'a> {
13421341/// ``` 
13431342/// use std::collections::HashSet; 
13441343/// 
1345- /// let a: HashSet<u32> = vec! [1, 2, 3].into_iter().collect( ); 
1346- /// let b: HashSet<_> =  [4, 2, 3, 4].iter().cloned().collect( ); 
1344+ /// let a = HashSet::from( [1, 2, 3]); 
1345+ /// let b = HashSet::from( [4, 2, 3, 4]); 
13471346/// 
13481347/// let mut difference = a.difference(&b); 
13491348/// ``` 
@@ -1369,8 +1368,8 @@ pub struct Difference<'a, T: 'a, S: 'a> {
13691368/// ``` 
13701369/// use std::collections::HashSet; 
13711370/// 
1372- /// let a: HashSet<u32> = vec! [1, 2, 3].into_iter().collect( ); 
1373- /// let b: HashSet<_> =  [4, 2, 3, 4].iter().cloned().collect( ); 
1371+ /// let a = HashSet::from( [1, 2, 3]); 
1372+ /// let b = HashSet::from( [4, 2, 3, 4]); 
13741373/// 
13751374/// let mut intersection = a.symmetric_difference(&b); 
13761375/// ``` 
@@ -1393,8 +1392,8 @@ pub struct SymmetricDifference<'a, T: 'a, S: 'a> {
13931392/// ``` 
13941393/// use std::collections::HashSet; 
13951394/// 
1396- /// let a: HashSet<u32> = vec! [1, 2, 3].into_iter().collect( ); 
1397- /// let b: HashSet<_> =  [4, 2, 3, 4].iter().cloned().collect( ); 
1395+ /// let a = HashSet::from( [1, 2, 3]); 
1396+ /// let b = HashSet::from( [4, 2, 3, 4]); 
13981397/// 
13991398/// let mut union_iter = a.union(&b); 
14001399/// ``` 
0 commit comments