@@ -116,8 +116,6 @@ use super::map::{self, HashMap, Keys, RandomState};
116
116
/// [`HashMap`]: struct.HashMap.html
117
117
/// [`PartialEq`]: ../../std/cmp/trait.PartialEq.html
118
118
/// [`RefCell`]: ../../std/cell/struct.RefCell.html
119
-
120
-
121
119
#[ derive( Clone ) ]
122
120
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
123
121
pub struct HashSet < T , S = RandomState > {
@@ -658,15 +656,14 @@ impl<T, S> HashSet<T, S>
658
656
/// # Examples
659
657
///
660
658
/// ```
661
- /// #![feature(retain_hash_collection)]
662
659
/// use std::collections::HashSet;
663
660
///
664
661
/// let xs = [1,2,3,4,5,6];
665
662
/// let mut set: HashSet<isize> = xs.iter().cloned().collect();
666
663
/// set.retain(|&k| k % 2 == 0);
667
664
/// assert_eq!(set.len(), 3);
668
665
/// ```
669
- #[ unstable ( feature = "retain_hash_collection" , issue = "36648 " ) ]
666
+ #[ stable ( feature = "retain_hash_collection" , since = "1.18.0 " ) ]
670
667
pub fn retain < F > ( & mut self , mut f : F )
671
668
where F : FnMut ( & T ) -> bool
672
669
{
@@ -1041,9 +1038,7 @@ impl<'a, K> FusedIterator for Iter<'a, K> {}
1041
1038
#[ stable( feature = "std_debug" , since = "1.16.0" ) ]
1042
1039
impl < ' a , K : fmt:: Debug > fmt:: Debug for Iter < ' a , K > {
1043
1040
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
1044
- f. debug_list ( )
1045
- . entries ( self . clone ( ) )
1046
- . finish ( )
1041
+ f. debug_list ( ) . entries ( self . clone ( ) ) . finish ( )
1047
1042
}
1048
1043
}
1049
1044
@@ -1070,10 +1065,11 @@ impl<K> FusedIterator for IntoIter<K> {}
1070
1065
#[ stable( feature = "std_debug" , since = "1.16.0" ) ]
1071
1066
impl < K : fmt:: Debug > fmt:: Debug for IntoIter < K > {
1072
1067
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
1073
- let entries_iter = self . iter . inner . iter ( ) . map ( |( k, _) | k) ;
1074
- f. debug_list ( )
1075
- . entries ( entries_iter)
1076
- . finish ( )
1068
+ let entries_iter = self . iter
1069
+ . inner
1070
+ . iter ( )
1071
+ . map ( |( k, _) | k) ;
1072
+ f. debug_list ( ) . entries ( entries_iter) . finish ( )
1077
1073
}
1078
1074
}
1079
1075
@@ -1100,10 +1096,11 @@ impl<'a, K> FusedIterator for Drain<'a, K> {}
1100
1096
#[ stable( feature = "std_debug" , since = "1.16.0" ) ]
1101
1097
impl < ' a , K : fmt:: Debug > fmt:: Debug for Drain < ' a , K > {
1102
1098
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
1103
- let entries_iter = self . iter . inner . iter ( ) . map ( |( k, _) | k) ;
1104
- f. debug_list ( )
1105
- . entries ( entries_iter)
1106
- . finish ( )
1099
+ let entries_iter = self . iter
1100
+ . inner
1101
+ . iter ( )
1102
+ . map ( |( k, _) | k) ;
1103
+ f. debug_list ( ) . entries ( entries_iter) . finish ( )
1107
1104
}
1108
1105
}
1109
1106
@@ -1143,12 +1140,10 @@ impl<'a, T, S> Iterator for Intersection<'a, T, S>
1143
1140
#[ stable( feature = "std_debug" , since = "1.16.0" ) ]
1144
1141
impl < ' a , T , S > fmt:: Debug for Intersection < ' a , T , S >
1145
1142
where T : fmt:: Debug + Eq + Hash ,
1146
- S : BuildHasher ,
1143
+ S : BuildHasher
1147
1144
{
1148
1145
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
1149
- f. debug_list ( )
1150
- . entries ( self . clone ( ) )
1151
- . finish ( )
1146
+ f. debug_list ( ) . entries ( self . clone ( ) ) . finish ( )
1152
1147
}
1153
1148
}
1154
1149
@@ -1202,12 +1197,10 @@ impl<'a, T, S> FusedIterator for Difference<'a, T, S>
1202
1197
#[ stable( feature = "std_debug" , since = "1.16.0" ) ]
1203
1198
impl < ' a , T , S > fmt:: Debug for Difference < ' a , T , S >
1204
1199
where T : fmt:: Debug + Eq + Hash ,
1205
- S : BuildHasher ,
1200
+ S : BuildHasher
1206
1201
{
1207
1202
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
1208
- f. debug_list ( )
1209
- . entries ( self . clone ( ) )
1210
- . finish ( )
1203
+ f. debug_list ( ) . entries ( self . clone ( ) ) . finish ( )
1211
1204
}
1212
1205
}
1213
1206
@@ -1243,12 +1236,10 @@ impl<'a, T, S> FusedIterator for SymmetricDifference<'a, T, S>
1243
1236
#[ stable( feature = "std_debug" , since = "1.16.0" ) ]
1244
1237
impl < ' a , T , S > fmt:: Debug for SymmetricDifference < ' a , T , S >
1245
1238
where T : fmt:: Debug + Eq + Hash ,
1246
- S : BuildHasher ,
1239
+ S : BuildHasher
1247
1240
{
1248
1241
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
1249
- f. debug_list ( )
1250
- . entries ( self . clone ( ) )
1251
- . finish ( )
1242
+ f. debug_list ( ) . entries ( self . clone ( ) ) . finish ( )
1252
1243
}
1253
1244
}
1254
1245
@@ -1269,12 +1260,10 @@ impl<'a, T, S> FusedIterator for Union<'a, T, S>
1269
1260
#[ stable( feature = "std_debug" , since = "1.16.0" ) ]
1270
1261
impl < ' a , T , S > fmt:: Debug for Union < ' a , T , S >
1271
1262
where T : fmt:: Debug + Eq + Hash ,
1272
- S : BuildHasher ,
1263
+ S : BuildHasher
1273
1264
{
1274
1265
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
1275
- f. debug_list ( )
1276
- . entries ( self . clone ( ) )
1277
- . finish ( )
1266
+ f. debug_list ( ) . entries ( self . clone ( ) ) . finish ( )
1278
1267
}
1279
1268
}
1280
1269
@@ -1698,7 +1687,7 @@ mod test_set {
1698
1687
1699
1688
#[ test]
1700
1689
fn test_retain ( ) {
1701
- let xs = [ 1 , 2 , 3 , 4 , 5 , 6 ] ;
1690
+ let xs = [ 1 , 2 , 3 , 4 , 5 , 6 ] ;
1702
1691
let mut set: HashSet < isize > = xs. iter ( ) . cloned ( ) . collect ( ) ;
1703
1692
set. retain ( |& k| k % 2 == 0 ) ;
1704
1693
assert_eq ! ( set. len( ) , 3 ) ;
0 commit comments