@@ -150,7 +150,7 @@ pub use fx::FxHashBuilder as DefaultHashBuilder;
150
150
/// }
151
151
///
152
152
/// impl Viking {
153
- /// /// Create a new Viking.
153
+ /// /// Creates a new Viking.
154
154
/// fn new(name: &str, country: &str) -> Viking {
155
155
/// Viking { name: name.to_string(), country: country.to_string() }
156
156
/// }
@@ -186,12 +186,12 @@ pub use fx::FxHashBuilder as DefaultHashBuilder;
186
186
187
187
#[ derive( Clone ) ]
188
188
pub struct HashMap < K , V , S = DefaultHashBuilder > {
189
- hash_builder : S ,
189
+ pub ( crate ) hash_builder : S ,
190
190
pub ( crate ) table : RawTable < ( K , V ) > ,
191
191
}
192
192
193
193
#[ inline]
194
- fn make_hash < K : Hash + ?Sized > ( hash_builder : & impl BuildHasher , val : & K ) -> u64 {
194
+ pub ( crate ) fn make_hash < K : Hash + ?Sized > ( hash_builder : & impl BuildHasher , val : & K ) -> u64 {
195
195
let mut state = hash_builder. build_hasher ( ) ;
196
196
val. hash ( & mut state) ;
197
197
state. finish ( )
@@ -232,8 +232,6 @@ impl<K, V> HashMap<K, V, DefaultHashBuilder> {
232
232
}
233
233
234
234
impl < K , V , S > HashMap < K , V , S >
235
- where
236
- S : BuildHasher ,
237
235
{
238
236
/// Creates an empty `HashMap` which will use the given hash builder to hash
239
237
/// keys.
@@ -486,7 +484,7 @@ where
486
484
self . table . len ( )
487
485
}
488
486
489
- /// Returns true if the map contains no elements.
487
+ /// Returns ` true` if the map contains no elements.
490
488
///
491
489
/// # Examples
492
490
///
@@ -757,7 +755,7 @@ where
757
755
} )
758
756
}
759
757
760
- /// Returns true if the map contains a value for the specified key.
758
+ /// Returns ` true` if the map contains a value for the specified key.
761
759
///
762
760
/// The key may be any borrowed form of the map's key type, but
763
761
/// [`Hash`] and [`Eq`] on the borrowed form *must* match those for
@@ -1220,7 +1218,7 @@ impl<'a, K, V: Debug> fmt::Debug for Values<'a, K, V> {
1220
1218
/// [`drain`]: struct.HashMap.html#method.drain
1221
1219
/// [`HashMap`]: struct.HashMap.html
1222
1220
pub struct Drain < ' a , K : ' a , V : ' a > {
1223
- pub ( super ) inner : RawDrain < ' a , ( K , V ) > ,
1221
+ inner : RawDrain < ' a , ( K , V ) > ,
1224
1222
}
1225
1223
1226
1224
impl < ' a , K , V > Drain < ' a , K , V > {
@@ -1300,9 +1298,8 @@ pub struct RawEntryBuilder<'a, K: 'a, V: 'a, S: 'a> {
1300
1298
impl < ' a , K , V , S > RawEntryBuilderMut < ' a , K , V , S >
1301
1299
where
1302
1300
S : BuildHasher ,
1303
- K : Eq + Hash ,
1304
1301
{
1305
- /// Create a `RawEntryMut` from the given key.
1302
+ /// Creates a `RawEntryMut` from the given key.
1306
1303
#[ inline]
1307
1304
#[ allow( clippy:: wrong_self_convention) ]
1308
1305
pub fn from_key < Q : ?Sized > ( self , k : & Q ) -> RawEntryMut < ' a , K , V , S >
@@ -1315,7 +1312,7 @@ where
1315
1312
self . from_key_hashed_nocheck ( hasher. finish ( ) , k)
1316
1313
}
1317
1314
1318
- /// Create a `RawEntryMut` from the given key and its hash.
1315
+ /// Creates a `RawEntryMut` from the given key and its hash.
1319
1316
#[ inline]
1320
1317
#[ allow( clippy:: wrong_self_convention) ]
1321
1318
pub fn from_key_hashed_nocheck < Q : ?Sized > ( self , hash : u64 , k : & Q ) -> RawEntryMut < ' a , K , V , S >
@@ -1331,7 +1328,7 @@ impl<'a, K, V, S> RawEntryBuilderMut<'a, K, V, S>
1331
1328
where
1332
1329
S : BuildHasher ,
1333
1330
{
1334
- /// Create a `RawEntryMut` from the given hash.
1331
+ /// Creates a `RawEntryMut` from the given hash.
1335
1332
#[ inline]
1336
1333
#[ allow( clippy:: wrong_self_convention) ]
1337
1334
pub fn from_hash < F > ( self , hash : u64 , is_match : F ) -> RawEntryMut < ' a , K , V , S >
@@ -1706,7 +1703,7 @@ pub enum Entry<'a, K: 'a, V: 'a, S: 'a> {
1706
1703
Vacant ( VacantEntry < ' a , K , V , S > ) ,
1707
1704
}
1708
1705
1709
- impl < ' a , K : ' a + Debug + Eq + Hash , V : ' a + Debug , S : ' a > Debug for Entry < ' a , K , V , S > {
1706
+ impl < ' a , K : ' a + Debug , V : ' a + Debug , S : ' a > Debug for Entry < ' a , K , V , S > {
1710
1707
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
1711
1708
match * self {
1712
1709
Entry :: Vacant ( ref v) => f. debug_tuple ( "Entry" ) . field ( v) . finish ( ) ,
@@ -1759,17 +1756,13 @@ pub struct VacantEntry<'a, K: 'a, V: 'a, S: 'a> {
1759
1756
table : & ' a mut HashMap < K , V , S > ,
1760
1757
}
1761
1758
1762
- impl < ' a , K : ' a + Debug + Eq + Hash , V : ' a , S > Debug for VacantEntry < ' a , K , V , S > {
1759
+ impl < ' a , K : ' a + Debug , V : ' a , S > Debug for VacantEntry < ' a , K , V , S > {
1763
1760
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
1764
1761
f. debug_tuple ( "VacantEntry" ) . field ( self . key ( ) ) . finish ( )
1765
1762
}
1766
1763
}
1767
1764
1768
- impl < ' a , K , V , S > IntoIterator for & ' a HashMap < K , V , S >
1769
- where
1770
- K : Eq + Hash ,
1771
- S : BuildHasher ,
1772
- {
1765
+ impl < ' a , K , V , S > IntoIterator for & ' a HashMap < K , V , S > {
1773
1766
type Item = ( & ' a K , & ' a V ) ;
1774
1767
type IntoIter = Iter < ' a , K , V > ;
1775
1768
@@ -1779,11 +1772,7 @@ where
1779
1772
}
1780
1773
}
1781
1774
1782
- impl < ' a , K , V , S > IntoIterator for & ' a mut HashMap < K , V , S >
1783
- where
1784
- K : Eq + Hash ,
1785
- S : BuildHasher ,
1786
- {
1775
+ impl < ' a , K , V , S > IntoIterator for & ' a mut HashMap < K , V , S > {
1787
1776
type Item = ( & ' a K , & ' a mut V ) ;
1788
1777
type IntoIter = IterMut < ' a , K , V > ;
1789
1778
@@ -1793,11 +1782,7 @@ where
1793
1782
}
1794
1783
}
1795
1784
1796
- impl < K , V , S > IntoIterator for HashMap < K , V , S >
1797
- where
1798
- K : Eq + Hash ,
1799
- S : BuildHasher ,
1800
- {
1785
+ impl < K , V , S > IntoIterator for HashMap < K , V , S > {
1801
1786
type Item = ( K , V ) ;
1802
1787
type IntoIter = IntoIter < K , V > ;
1803
1788
0 commit comments