@@ -37,7 +37,6 @@ use super::map::{self, HashMap, Keys, RandomState};
3737/// # Examples
3838///
3939/// ```
40- /// use std::collections::HashSet;
4140/// // Type inference lets us omit an explicit type signature (which
4241/// // would be `HashSet<String>` in this example).
4342/// let mut books = HashSet::new();
@@ -68,7 +67,6 @@ use super::map::{self, HashMap, Keys, RandomState};
6867/// future be implied by [`Eq`].
6968///
7069/// ```
71- /// use std::collections::HashSet;
7270/// #[derive(Hash, Eq, PartialEq, Debug)]
7371/// struct Viking {
7472/// name: String,
@@ -91,8 +89,6 @@ use super::map::{self, HashMap, Keys, RandomState};
9189/// A `HashSet` with fixed list of elements can be initialized from an array:
9290///
9391/// ```
94- /// use std::collections::HashSet;
95- ///
9692/// fn main() {
9793/// let viking_names: HashSet<&'static str> =
9894/// [ "Einar", "Olaf", "Harald" ].iter().cloned().collect();
@@ -121,7 +117,6 @@ impl<T: Hash + Eq> HashSet<T, RandomState> {
121117 /// # Examples
122118 ///
123119 /// ```
124- /// use std::collections::HashSet;
125120 /// let set: HashSet<i32> = HashSet::new();
126121 /// ```
127122 #[ inline]
@@ -138,7 +133,6 @@ impl<T: Hash + Eq> HashSet<T, RandomState> {
138133 /// # Examples
139134 ///
140135 /// ```
141- /// use std::collections::HashSet;
142136 /// let set: HashSet<i32> = HashSet::with_capacity(10);
143137 /// assert!(set.capacity() >= 10);
144138 /// ```
@@ -155,7 +149,6 @@ impl<T, S> HashSet<T, S> {
155149 /// # Examples
156150 ///
157151 /// ```
158- /// use std::collections::HashSet;
159152 /// let set: HashSet<i32> = HashSet::with_capacity(100);
160153 /// assert!(set.capacity() >= 100);
161154 /// ```
@@ -171,7 +164,6 @@ impl<T, S> HashSet<T, S> {
171164 /// # Examples
172165 ///
173166 /// ```
174- /// use std::collections::HashSet;
175167 /// let mut set = HashSet::new();
176168 /// set.insert("a");
177169 /// set.insert("b");
@@ -192,8 +184,6 @@ impl<T, S> HashSet<T, S> {
192184 /// # Examples
193185 ///
194186 /// ```
195- /// use std::collections::HashSet;
196- ///
197187 /// let mut v = HashSet::new();
198188 /// assert_eq!(v.len(), 0);
199189 /// v.insert(1);
@@ -210,8 +200,6 @@ impl<T, S> HashSet<T, S> {
210200 /// # Examples
211201 ///
212202 /// ```
213- /// use std::collections::HashSet;
214- ///
215203 /// let mut v = HashSet::new();
216204 /// assert!(v.is_empty());
217205 /// v.insert(1);
@@ -228,8 +216,6 @@ impl<T, S> HashSet<T, S> {
228216 /// # Examples
229217 ///
230218 /// ```
231- /// use std::collections::HashSet;
232- ///
233219 /// let mut set: HashSet<_> = [1, 2, 3].iter().cloned().collect();
234220 /// assert!(!set.is_empty());
235221 ///
@@ -251,8 +237,6 @@ impl<T, S> HashSet<T, S> {
251237 /// # Examples
252238 ///
253239 /// ```
254- /// use std::collections::HashSet;
255- ///
256240 /// let mut v = HashSet::new();
257241 /// v.insert(1);
258242 /// v.clear();
@@ -282,7 +266,6 @@ impl<T, S> HashSet<T, S>
282266 /// # Examples
283267 ///
284268 /// ```
285- /// use std::collections::HashSet;
286269 /// use std::collections::hash_map::RandomState;
287270 ///
288271 /// let s = RandomState::new();
@@ -309,7 +292,6 @@ impl<T, S> HashSet<T, S>
309292 /// # Examples
310293 ///
311294 /// ```
312- /// use std::collections::HashSet;
313295 /// use std::collections::hash_map::RandomState;
314296 ///
315297 /// let s = RandomState::new();
@@ -329,7 +311,6 @@ impl<T, S> HashSet<T, S>
329311 /// # Examples
330312 ///
331313 /// ```
332- /// use std::collections::HashSet;
333314 /// use std::collections::hash_map::RandomState;
334315 ///
335316 /// let hasher = RandomState::new();
@@ -353,7 +334,6 @@ impl<T, S> HashSet<T, S>
353334 /// # Examples
354335 ///
355336 /// ```
356- /// use std::collections::HashSet;
357337 /// let mut set: HashSet<i32> = HashSet::new();
358338 /// set.reserve(10);
359339 /// assert!(set.capacity() >= 10);
@@ -377,7 +357,6 @@ impl<T, S> HashSet<T, S>
377357 ///
378358 /// ```
379359 /// #![feature(try_reserve)]
380- /// use std::collections::HashSet;
381360 /// let mut set: HashSet<i32> = HashSet::new();
382361 /// set.try_reserve(10).expect("why is the test harness OOMing on 10 bytes?");
383362 /// ```
@@ -394,8 +373,6 @@ impl<T, S> HashSet<T, S>
394373 /// # Examples
395374 ///
396375 /// ```
397- /// use std::collections::HashSet;
398- ///
399376 /// let mut set = HashSet::with_capacity(100);
400377 /// set.insert(1);
401378 /// set.insert(2);
@@ -420,8 +397,6 @@ impl<T, S> HashSet<T, S>
420397 ///
421398 /// ```
422399 /// #![feature(shrink_to)]
423- /// use std::collections::HashSet;
424- ///
425400 /// let mut set = HashSet::with_capacity(100);
426401 /// set.insert(1);
427402 /// set.insert(2);
@@ -443,7 +418,6 @@ impl<T, S> HashSet<T, S>
443418 /// # Examples
444419 ///
445420 /// ```
446- /// use std::collections::HashSet;
447421 /// let a: HashSet<_> = [1, 2, 3].iter().cloned().collect();
448422 /// let b: HashSet<_> = [4, 2, 3, 4].iter().cloned().collect();
449423 ///
@@ -475,7 +449,6 @@ impl<T, S> HashSet<T, S>
475449 /// # Examples
476450 ///
477451 /// ```
478- /// use std::collections::HashSet;
479452 /// let a: HashSet<_> = [1, 2, 3].iter().cloned().collect();
480453 /// let b: HashSet<_> = [4, 2, 3, 4].iter().cloned().collect();
481454 ///
@@ -504,7 +477,6 @@ impl<T, S> HashSet<T, S>
504477 /// # Examples
505478 ///
506479 /// ```
507- /// use std::collections::HashSet;
508480 /// let a: HashSet<_> = [1, 2, 3].iter().cloned().collect();
509481 /// let b: HashSet<_> = [4, 2, 3, 4].iter().cloned().collect();
510482 ///
@@ -538,7 +510,6 @@ impl<T, S> HashSet<T, S>
538510 /// # Examples
539511 ///
540512 /// ```
541- /// use std::collections::HashSet;
542513 /// let a: HashSet<_> = [1, 2, 3].iter().cloned().collect();
543514 /// let b: HashSet<_> = [4, 2, 3, 4].iter().cloned().collect();
544515 ///
@@ -573,8 +544,6 @@ impl<T, S> HashSet<T, S>
573544 /// # Examples
574545 ///
575546 /// ```
576- /// use std::collections::HashSet;
577- ///
578547 /// let set: HashSet<_> = [1, 2, 3].iter().cloned().collect();
579548 /// assert_eq!(set.contains(&1), true);
580549 /// assert_eq!(set.contains(&4), false);
@@ -600,8 +569,6 @@ impl<T, S> HashSet<T, S>
600569 /// # Examples
601570 ///
602571 /// ```
603- /// use std::collections::HashSet;
604- ///
605572 /// let set: HashSet<_> = [1, 2, 3].iter().cloned().collect();
606573 /// assert_eq!(set.get(&2), Some(&2));
607574 /// assert_eq!(set.get(&4), None);
@@ -626,8 +593,6 @@ impl<T, S> HashSet<T, S>
626593 /// ```
627594 /// #![feature(hash_set_entry)]
628595 ///
629- /// use std::collections::HashSet;
630- ///
631596 /// let mut set: HashSet<_> = [1, 2, 3].iter().cloned().collect();
632597 /// assert_eq!(set.len(), 3);
633598 /// assert_eq!(set.get_or_insert(2), &2);
@@ -650,8 +615,6 @@ impl<T, S> HashSet<T, S>
650615 /// ```
651616 /// #![feature(hash_set_entry)]
652617 ///
653- /// use std::collections::HashSet;
654- ///
655618 /// let mut set: HashSet<String> = ["cat", "dog", "horse"]
656619 /// .iter().map(|&pet| pet.to_owned()).collect();
657620 ///
@@ -680,8 +643,6 @@ impl<T, S> HashSet<T, S>
680643 /// # Examples
681644 ///
682645 /// ```
683- /// use std::collections::HashSet;
684- ///
685646 /// let a: HashSet<_> = [1, 2, 3].iter().cloned().collect();
686647 /// let mut b = HashSet::new();
687648 ///
@@ -706,8 +667,6 @@ impl<T, S> HashSet<T, S>
706667 /// # Examples
707668 ///
708669 /// ```
709- /// use std::collections::HashSet;
710- ///
711670 /// let sup: HashSet<_> = [1, 2, 3].iter().cloned().collect();
712671 /// let mut set = HashSet::new();
713672 ///
@@ -732,8 +691,6 @@ impl<T, S> HashSet<T, S>
732691 /// # Examples
733692 ///
734693 /// ```
735- /// use std::collections::HashSet;
736- ///
737694 /// let sub: HashSet<_> = [1, 2].iter().cloned().collect();
738695 /// let mut set = HashSet::new();
739696 ///
@@ -761,8 +718,6 @@ impl<T, S> HashSet<T, S>
761718 /// # Examples
762719 ///
763720 /// ```
764- /// use std::collections::HashSet;
765- ///
766721 /// let mut set = HashSet::new();
767722 ///
768723 /// assert_eq!(set.insert(2), true);
@@ -781,8 +736,6 @@ impl<T, S> HashSet<T, S>
781736 /// # Examples
782737 ///
783738 /// ```
784- /// use std::collections::HashSet;
785- ///
786739 /// let mut set = HashSet::new();
787740 /// set.insert(Vec::<i32>::new());
788741 ///
@@ -812,8 +765,6 @@ impl<T, S> HashSet<T, S>
812765 /// # Examples
813766 ///
814767 /// ```
815- /// use std::collections::HashSet;
816- ///
817768 /// let mut set = HashSet::new();
818769 ///
819770 /// set.insert(2);
@@ -841,8 +792,6 @@ impl<T, S> HashSet<T, S>
841792 /// # Examples
842793 ///
843794 /// ```
844- /// use std::collections::HashSet;
845- ///
846795 /// let mut set: HashSet<_> = [1, 2, 3].iter().cloned().collect();
847796 /// assert_eq!(set.take(&2), Some(2));
848797 /// assert_eq!(set.take(&2), None);
@@ -866,8 +815,6 @@ impl<T, S> HashSet<T, S>
866815 /// # Examples
867816 ///
868817 /// ```
869- /// use std::collections::HashSet;
870- ///
871818 /// let xs = [1,2,3,4,5,6];
872819 /// let mut set: HashSet<i32> = xs.iter().cloned().collect();
873820 /// set.retain(|&k| k % 2 == 0);
@@ -971,8 +918,6 @@ impl<T, S> BitOr<&HashSet<T, S>> for &HashSet<T, S>
971918 /// # Examples
972919 ///
973920 /// ```
974- /// use std::collections::HashSet;
975- ///
976921 /// let a: HashSet<_> = vec![1, 2, 3].into_iter().collect();
977922 /// let b: HashSet<_> = vec![3, 4, 5].into_iter().collect();
978923 ///
@@ -1003,8 +948,6 @@ impl<T, S> BitAnd<&HashSet<T, S>> for &HashSet<T, S>
1003948 /// # Examples
1004949 ///
1005950 /// ```
1006- /// use std::collections::HashSet;
1007- ///
1008951 /// let a: HashSet<_> = vec![1, 2, 3].into_iter().collect();
1009952 /// let b: HashSet<_> = vec![2, 3, 4].into_iter().collect();
1010953 ///
@@ -1035,8 +978,6 @@ impl<T, S> BitXor<&HashSet<T, S>> for &HashSet<T, S>
1035978 /// # Examples
1036979 ///
1037980 /// ```
1038- /// use std::collections::HashSet;
1039- ///
1040981 /// let a: HashSet<_> = vec![1, 2, 3].into_iter().collect();
1041982 /// let b: HashSet<_> = vec![3, 4, 5].into_iter().collect();
1042983 ///
@@ -1067,8 +1008,6 @@ impl<T, S> Sub<&HashSet<T, S>> for &HashSet<T, S>
10671008 /// # Examples
10681009 ///
10691010 /// ```
1070- /// use std::collections::HashSet;
1071- ///
10721011 /// let a: HashSet<_> = vec![1, 2, 3].into_iter().collect();
10731012 /// let b: HashSet<_> = vec![3, 4, 5].into_iter().collect();
10741013 ///
@@ -1200,7 +1139,6 @@ impl<T, S> IntoIterator for HashSet<T, S> {
12001139 /// # Examples
12011140 ///
12021141 /// ```
1203- /// use std::collections::HashSet;
12041142 /// let mut set = HashSet::new();
12051143 /// set.insert("a".to_string());
12061144 /// set.insert("b".to_string());
0 commit comments