@@ -37,7 +37,6 @@ use super::map::{self, HashMap, Keys, RandomState};
37
37
/// # Examples
38
38
///
39
39
/// ```
40
- /// use std::collections::HashSet;
41
40
/// // Type inference lets us omit an explicit type signature (which
42
41
/// // would be `HashSet<String>` in this example).
43
42
/// let mut books = HashSet::new();
@@ -68,7 +67,6 @@ use super::map::{self, HashMap, Keys, RandomState};
68
67
/// future be implied by [`Eq`].
69
68
///
70
69
/// ```
71
- /// use std::collections::HashSet;
72
70
/// #[derive(Hash, Eq, PartialEq, Debug)]
73
71
/// struct Viking {
74
72
/// name: String,
@@ -91,8 +89,6 @@ use super::map::{self, HashMap, Keys, RandomState};
91
89
/// A `HashSet` with fixed list of elements can be initialized from an array:
92
90
///
93
91
/// ```
94
- /// use std::collections::HashSet;
95
- ///
96
92
/// fn main() {
97
93
/// let viking_names: HashSet<&'static str> =
98
94
/// [ "Einar", "Olaf", "Harald" ].iter().cloned().collect();
@@ -121,7 +117,6 @@ impl<T: Hash + Eq> HashSet<T, RandomState> {
121
117
/// # Examples
122
118
///
123
119
/// ```
124
- /// use std::collections::HashSet;
125
120
/// let set: HashSet<i32> = HashSet::new();
126
121
/// ```
127
122
#[ inline]
@@ -138,7 +133,6 @@ impl<T: Hash + Eq> HashSet<T, RandomState> {
138
133
/// # Examples
139
134
///
140
135
/// ```
141
- /// use std::collections::HashSet;
142
136
/// let set: HashSet<i32> = HashSet::with_capacity(10);
143
137
/// assert!(set.capacity() >= 10);
144
138
/// ```
@@ -155,7 +149,6 @@ impl<T, S> HashSet<T, S> {
155
149
/// # Examples
156
150
///
157
151
/// ```
158
- /// use std::collections::HashSet;
159
152
/// let set: HashSet<i32> = HashSet::with_capacity(100);
160
153
/// assert!(set.capacity() >= 100);
161
154
/// ```
@@ -171,7 +164,6 @@ impl<T, S> HashSet<T, S> {
171
164
/// # Examples
172
165
///
173
166
/// ```
174
- /// use std::collections::HashSet;
175
167
/// let mut set = HashSet::new();
176
168
/// set.insert("a");
177
169
/// set.insert("b");
@@ -192,8 +184,6 @@ impl<T, S> HashSet<T, S> {
192
184
/// # Examples
193
185
///
194
186
/// ```
195
- /// use std::collections::HashSet;
196
- ///
197
187
/// let mut v = HashSet::new();
198
188
/// assert_eq!(v.len(), 0);
199
189
/// v.insert(1);
@@ -210,8 +200,6 @@ impl<T, S> HashSet<T, S> {
210
200
/// # Examples
211
201
///
212
202
/// ```
213
- /// use std::collections::HashSet;
214
- ///
215
203
/// let mut v = HashSet::new();
216
204
/// assert!(v.is_empty());
217
205
/// v.insert(1);
@@ -228,8 +216,6 @@ impl<T, S> HashSet<T, S> {
228
216
/// # Examples
229
217
///
230
218
/// ```
231
- /// use std::collections::HashSet;
232
- ///
233
219
/// let mut set: HashSet<_> = [1, 2, 3].iter().cloned().collect();
234
220
/// assert!(!set.is_empty());
235
221
///
@@ -251,8 +237,6 @@ impl<T, S> HashSet<T, S> {
251
237
/// # Examples
252
238
///
253
239
/// ```
254
- /// use std::collections::HashSet;
255
- ///
256
240
/// let mut v = HashSet::new();
257
241
/// v.insert(1);
258
242
/// v.clear();
@@ -282,7 +266,6 @@ impl<T, S> HashSet<T, S>
282
266
/// # Examples
283
267
///
284
268
/// ```
285
- /// use std::collections::HashSet;
286
269
/// use std::collections::hash_map::RandomState;
287
270
///
288
271
/// let s = RandomState::new();
@@ -309,7 +292,6 @@ impl<T, S> HashSet<T, S>
309
292
/// # Examples
310
293
///
311
294
/// ```
312
- /// use std::collections::HashSet;
313
295
/// use std::collections::hash_map::RandomState;
314
296
///
315
297
/// let s = RandomState::new();
@@ -329,7 +311,6 @@ impl<T, S> HashSet<T, S>
329
311
/// # Examples
330
312
///
331
313
/// ```
332
- /// use std::collections::HashSet;
333
314
/// use std::collections::hash_map::RandomState;
334
315
///
335
316
/// let hasher = RandomState::new();
@@ -353,7 +334,6 @@ impl<T, S> HashSet<T, S>
353
334
/// # Examples
354
335
///
355
336
/// ```
356
- /// use std::collections::HashSet;
357
337
/// let mut set: HashSet<i32> = HashSet::new();
358
338
/// set.reserve(10);
359
339
/// assert!(set.capacity() >= 10);
@@ -377,7 +357,6 @@ impl<T, S> HashSet<T, S>
377
357
///
378
358
/// ```
379
359
/// #![feature(try_reserve)]
380
- /// use std::collections::HashSet;
381
360
/// let mut set: HashSet<i32> = HashSet::new();
382
361
/// set.try_reserve(10).expect("why is the test harness OOMing on 10 bytes?");
383
362
/// ```
@@ -394,8 +373,6 @@ impl<T, S> HashSet<T, S>
394
373
/// # Examples
395
374
///
396
375
/// ```
397
- /// use std::collections::HashSet;
398
- ///
399
376
/// let mut set = HashSet::with_capacity(100);
400
377
/// set.insert(1);
401
378
/// set.insert(2);
@@ -420,8 +397,6 @@ impl<T, S> HashSet<T, S>
420
397
///
421
398
/// ```
422
399
/// #![feature(shrink_to)]
423
- /// use std::collections::HashSet;
424
- ///
425
400
/// let mut set = HashSet::with_capacity(100);
426
401
/// set.insert(1);
427
402
/// set.insert(2);
@@ -443,7 +418,6 @@ impl<T, S> HashSet<T, S>
443
418
/// # Examples
444
419
///
445
420
/// ```
446
- /// use std::collections::HashSet;
447
421
/// let a: HashSet<_> = [1, 2, 3].iter().cloned().collect();
448
422
/// let b: HashSet<_> = [4, 2, 3, 4].iter().cloned().collect();
449
423
///
@@ -475,7 +449,6 @@ impl<T, S> HashSet<T, S>
475
449
/// # Examples
476
450
///
477
451
/// ```
478
- /// use std::collections::HashSet;
479
452
/// let a: HashSet<_> = [1, 2, 3].iter().cloned().collect();
480
453
/// let b: HashSet<_> = [4, 2, 3, 4].iter().cloned().collect();
481
454
///
@@ -504,7 +477,6 @@ impl<T, S> HashSet<T, S>
504
477
/// # Examples
505
478
///
506
479
/// ```
507
- /// use std::collections::HashSet;
508
480
/// let a: HashSet<_> = [1, 2, 3].iter().cloned().collect();
509
481
/// let b: HashSet<_> = [4, 2, 3, 4].iter().cloned().collect();
510
482
///
@@ -538,7 +510,6 @@ impl<T, S> HashSet<T, S>
538
510
/// # Examples
539
511
///
540
512
/// ```
541
- /// use std::collections::HashSet;
542
513
/// let a: HashSet<_> = [1, 2, 3].iter().cloned().collect();
543
514
/// let b: HashSet<_> = [4, 2, 3, 4].iter().cloned().collect();
544
515
///
@@ -573,8 +544,6 @@ impl<T, S> HashSet<T, S>
573
544
/// # Examples
574
545
///
575
546
/// ```
576
- /// use std::collections::HashSet;
577
- ///
578
547
/// let set: HashSet<_> = [1, 2, 3].iter().cloned().collect();
579
548
/// assert_eq!(set.contains(&1), true);
580
549
/// assert_eq!(set.contains(&4), false);
@@ -600,8 +569,6 @@ impl<T, S> HashSet<T, S>
600
569
/// # Examples
601
570
///
602
571
/// ```
603
- /// use std::collections::HashSet;
604
- ///
605
572
/// let set: HashSet<_> = [1, 2, 3].iter().cloned().collect();
606
573
/// assert_eq!(set.get(&2), Some(&2));
607
574
/// assert_eq!(set.get(&4), None);
@@ -626,8 +593,6 @@ impl<T, S> HashSet<T, S>
626
593
/// ```
627
594
/// #![feature(hash_set_entry)]
628
595
///
629
- /// use std::collections::HashSet;
630
- ///
631
596
/// let mut set: HashSet<_> = [1, 2, 3].iter().cloned().collect();
632
597
/// assert_eq!(set.len(), 3);
633
598
/// assert_eq!(set.get_or_insert(2), &2);
@@ -650,8 +615,6 @@ impl<T, S> HashSet<T, S>
650
615
/// ```
651
616
/// #![feature(hash_set_entry)]
652
617
///
653
- /// use std::collections::HashSet;
654
- ///
655
618
/// let mut set: HashSet<String> = ["cat", "dog", "horse"]
656
619
/// .iter().map(|&pet| pet.to_owned()).collect();
657
620
///
@@ -680,8 +643,6 @@ impl<T, S> HashSet<T, S>
680
643
/// # Examples
681
644
///
682
645
/// ```
683
- /// use std::collections::HashSet;
684
- ///
685
646
/// let a: HashSet<_> = [1, 2, 3].iter().cloned().collect();
686
647
/// let mut b = HashSet::new();
687
648
///
@@ -706,8 +667,6 @@ impl<T, S> HashSet<T, S>
706
667
/// # Examples
707
668
///
708
669
/// ```
709
- /// use std::collections::HashSet;
710
- ///
711
670
/// let sup: HashSet<_> = [1, 2, 3].iter().cloned().collect();
712
671
/// let mut set = HashSet::new();
713
672
///
@@ -732,8 +691,6 @@ impl<T, S> HashSet<T, S>
732
691
/// # Examples
733
692
///
734
693
/// ```
735
- /// use std::collections::HashSet;
736
- ///
737
694
/// let sub: HashSet<_> = [1, 2].iter().cloned().collect();
738
695
/// let mut set = HashSet::new();
739
696
///
@@ -761,8 +718,6 @@ impl<T, S> HashSet<T, S>
761
718
/// # Examples
762
719
///
763
720
/// ```
764
- /// use std::collections::HashSet;
765
- ///
766
721
/// let mut set = HashSet::new();
767
722
///
768
723
/// assert_eq!(set.insert(2), true);
@@ -781,8 +736,6 @@ impl<T, S> HashSet<T, S>
781
736
/// # Examples
782
737
///
783
738
/// ```
784
- /// use std::collections::HashSet;
785
- ///
786
739
/// let mut set = HashSet::new();
787
740
/// set.insert(Vec::<i32>::new());
788
741
///
@@ -812,8 +765,6 @@ impl<T, S> HashSet<T, S>
812
765
/// # Examples
813
766
///
814
767
/// ```
815
- /// use std::collections::HashSet;
816
- ///
817
768
/// let mut set = HashSet::new();
818
769
///
819
770
/// set.insert(2);
@@ -841,8 +792,6 @@ impl<T, S> HashSet<T, S>
841
792
/// # Examples
842
793
///
843
794
/// ```
844
- /// use std::collections::HashSet;
845
- ///
846
795
/// let mut set: HashSet<_> = [1, 2, 3].iter().cloned().collect();
847
796
/// assert_eq!(set.take(&2), Some(2));
848
797
/// assert_eq!(set.take(&2), None);
@@ -866,8 +815,6 @@ impl<T, S> HashSet<T, S>
866
815
/// # Examples
867
816
///
868
817
/// ```
869
- /// use std::collections::HashSet;
870
- ///
871
818
/// let xs = [1,2,3,4,5,6];
872
819
/// let mut set: HashSet<i32> = xs.iter().cloned().collect();
873
820
/// set.retain(|&k| k % 2 == 0);
@@ -971,8 +918,6 @@ impl<T, S> BitOr<&HashSet<T, S>> for &HashSet<T, S>
971
918
/// # Examples
972
919
///
973
920
/// ```
974
- /// use std::collections::HashSet;
975
- ///
976
921
/// let a: HashSet<_> = vec![1, 2, 3].into_iter().collect();
977
922
/// let b: HashSet<_> = vec![3, 4, 5].into_iter().collect();
978
923
///
@@ -1003,8 +948,6 @@ impl<T, S> BitAnd<&HashSet<T, S>> for &HashSet<T, S>
1003
948
/// # Examples
1004
949
///
1005
950
/// ```
1006
- /// use std::collections::HashSet;
1007
- ///
1008
951
/// let a: HashSet<_> = vec![1, 2, 3].into_iter().collect();
1009
952
/// let b: HashSet<_> = vec![2, 3, 4].into_iter().collect();
1010
953
///
@@ -1035,8 +978,6 @@ impl<T, S> BitXor<&HashSet<T, S>> for &HashSet<T, S>
1035
978
/// # Examples
1036
979
///
1037
980
/// ```
1038
- /// use std::collections::HashSet;
1039
- ///
1040
981
/// let a: HashSet<_> = vec![1, 2, 3].into_iter().collect();
1041
982
/// let b: HashSet<_> = vec![3, 4, 5].into_iter().collect();
1042
983
///
@@ -1067,8 +1008,6 @@ impl<T, S> Sub<&HashSet<T, S>> for &HashSet<T, S>
1067
1008
/// # Examples
1068
1009
///
1069
1010
/// ```
1070
- /// use std::collections::HashSet;
1071
- ///
1072
1011
/// let a: HashSet<_> = vec![1, 2, 3].into_iter().collect();
1073
1012
/// let b: HashSet<_> = vec![3, 4, 5].into_iter().collect();
1074
1013
///
@@ -1200,7 +1139,6 @@ impl<T, S> IntoIterator for HashSet<T, S> {
1200
1139
/// # Examples
1201
1140
///
1202
1141
/// ```
1203
- /// use std::collections::HashSet;
1204
1142
/// let mut set = HashSet::new();
1205
1143
/// set.insert("a".to_string());
1206
1144
/// set.insert("b".to_string());
0 commit comments