@@ -224,7 +224,7 @@ where
224
224
#[ cfg_attr( feature = "inline-more" , inline) ]
225
225
fn equivalent_key < Q , K , V > ( k : & Q ) -> impl Fn ( & ( K , V ) ) -> bool + ' _
226
226
where
227
- Q : ? Sized + Equivalent < K > ,
227
+ Q : Equivalent < K > + ? Sized ,
228
228
{
229
229
move |x| k. equivalent ( & x. 0 )
230
230
}
@@ -234,7 +234,7 @@ where
234
234
#[ cfg_attr( feature = "inline-more" , inline) ]
235
235
fn equivalent < Q , K > ( k : & Q ) -> impl Fn ( & K ) -> bool + ' _
236
236
where
237
- Q : ? Sized + Equivalent < K > ,
237
+ Q : Equivalent < K > + ? Sized ,
238
238
{
239
239
move |x| k. equivalent ( x)
240
240
}
@@ -1264,9 +1264,9 @@ where
1264
1264
/// assert_eq!(words["horseyland"], 1);
1265
1265
/// ```
1266
1266
#[ cfg_attr( feature = "inline-more" , inline) ]
1267
- pub fn entry_ref < ' a , ' b , Q : ? Sized > ( & ' a mut self , key : & ' b Q ) -> EntryRef < ' a , ' b , K , Q , V , S , A >
1267
+ pub fn entry_ref < ' a , ' b , Q > ( & ' a mut self , key : & ' b Q ) -> EntryRef < ' a , ' b , K , Q , V , S , A >
1268
1268
where
1269
- Q : Hash + Equivalent < K > ,
1269
+ Q : Hash + Equivalent < K > + ? Sized ,
1270
1270
{
1271
1271
let hash = make_hash :: < Q , S > ( & self . hash_builder , key) ;
1272
1272
if let Some ( elem) = self . table . find ( hash, equivalent_key ( key) ) {
@@ -1305,9 +1305,9 @@ where
1305
1305
/// assert_eq!(map.get(&2), None);
1306
1306
/// ```
1307
1307
#[ inline]
1308
- pub fn get < Q : ? Sized > ( & self , k : & Q ) -> Option < & V >
1308
+ pub fn get < Q > ( & self , k : & Q ) -> Option < & V >
1309
1309
where
1310
- Q : Hash + Equivalent < K > ,
1310
+ Q : Hash + Equivalent < K > + ? Sized ,
1311
1311
{
1312
1312
// Avoid `Option::map` because it bloats LLVM IR.
1313
1313
match self . get_inner ( k) {
@@ -1336,9 +1336,9 @@ where
1336
1336
/// assert_eq!(map.get_key_value(&2), None);
1337
1337
/// ```
1338
1338
#[ inline]
1339
- pub fn get_key_value < Q : ? Sized > ( & self , k : & Q ) -> Option < ( & K , & V ) >
1339
+ pub fn get_key_value < Q > ( & self , k : & Q ) -> Option < ( & K , & V ) >
1340
1340
where
1341
- Q : Hash + Equivalent < K > ,
1341
+ Q : Hash + Equivalent < K > + ? Sized ,
1342
1342
{
1343
1343
// Avoid `Option::map` because it bloats LLVM IR.
1344
1344
match self . get_inner ( k) {
@@ -1348,9 +1348,9 @@ where
1348
1348
}
1349
1349
1350
1350
#[ inline]
1351
- fn get_inner < Q : ? Sized > ( & self , k : & Q ) -> Option < & ( K , V ) >
1351
+ fn get_inner < Q > ( & self , k : & Q ) -> Option < & ( K , V ) >
1352
1352
where
1353
- Q : Hash + Equivalent < K > ,
1353
+ Q : Hash + Equivalent < K > + ? Sized ,
1354
1354
{
1355
1355
if self . table . is_empty ( ) {
1356
1356
None
@@ -1384,9 +1384,9 @@ where
1384
1384
/// assert_eq!(map.get_key_value_mut(&2), None);
1385
1385
/// ```
1386
1386
#[ inline]
1387
- pub fn get_key_value_mut < Q : ? Sized > ( & mut self , k : & Q ) -> Option < ( & K , & mut V ) >
1387
+ pub fn get_key_value_mut < Q > ( & mut self , k : & Q ) -> Option < ( & K , & mut V ) >
1388
1388
where
1389
- Q : Hash + Equivalent < K > ,
1389
+ Q : Hash + Equivalent < K > + ? Sized ,
1390
1390
{
1391
1391
// Avoid `Option::map` because it bloats LLVM IR.
1392
1392
match self . get_inner_mut ( k) {
@@ -1415,9 +1415,9 @@ where
1415
1415
/// assert_eq!(map.contains_key(&2), false);
1416
1416
/// ```
1417
1417
#[ cfg_attr( feature = "inline-more" , inline) ]
1418
- pub fn contains_key < Q : ? Sized > ( & self , k : & Q ) -> bool
1418
+ pub fn contains_key < Q > ( & self , k : & Q ) -> bool
1419
1419
where
1420
- Q : Hash + Equivalent < K > ,
1420
+ Q : Hash + Equivalent < K > + ? Sized ,
1421
1421
{
1422
1422
self . get_inner ( k) . is_some ( )
1423
1423
}
@@ -1446,9 +1446,9 @@ where
1446
1446
/// assert_eq!(map.get_mut(&2), None);
1447
1447
/// ```
1448
1448
#[ cfg_attr( feature = "inline-more" , inline) ]
1449
- pub fn get_mut < Q : ? Sized > ( & mut self , k : & Q ) -> Option < & mut V >
1449
+ pub fn get_mut < Q > ( & mut self , k : & Q ) -> Option < & mut V >
1450
1450
where
1451
- Q : Hash + Equivalent < K > ,
1451
+ Q : Hash + Equivalent < K > + ? Sized ,
1452
1452
{
1453
1453
// Avoid `Option::map` because it bloats LLVM IR.
1454
1454
match self . get_inner_mut ( k) {
@@ -1458,9 +1458,9 @@ where
1458
1458
}
1459
1459
1460
1460
#[ inline]
1461
- fn get_inner_mut < Q : ? Sized > ( & mut self , k : & Q ) -> Option < & mut ( K , V ) >
1461
+ fn get_inner_mut < Q > ( & mut self , k : & Q ) -> Option < & mut ( K , V ) >
1462
1462
where
1463
- Q : Hash + Equivalent < K > ,
1463
+ Q : Hash + Equivalent < K > + ? Sized ,
1464
1464
{
1465
1465
if self . table . is_empty ( ) {
1466
1466
None
@@ -1513,9 +1513,9 @@ where
1513
1513
/// ]);
1514
1514
/// assert_eq!(got, None);
1515
1515
/// ```
1516
- pub fn get_many_mut < Q : ? Sized , const N : usize > ( & mut self , ks : [ & Q ; N ] ) -> Option < [ & ' _ mut V ; N ] >
1516
+ pub fn get_many_mut < Q , const N : usize > ( & mut self , ks : [ & Q ; N ] ) -> Option < [ & ' _ mut V ; N ] >
1517
1517
where
1518
- Q : Hash + Equivalent < K > ,
1518
+ Q : Hash + Equivalent < K > + ? Sized ,
1519
1519
{
1520
1520
self . get_many_mut_inner ( ks) . map ( |res| res. map ( |( _, v) | v) )
1521
1521
}
@@ -1565,12 +1565,12 @@ where
1565
1565
/// ]);
1566
1566
/// assert_eq!(got, None);
1567
1567
/// ```
1568
- pub unsafe fn get_many_unchecked_mut < Q : ? Sized , const N : usize > (
1568
+ pub unsafe fn get_many_unchecked_mut < Q , const N : usize > (
1569
1569
& mut self ,
1570
1570
ks : [ & Q ; N ] ,
1571
1571
) -> Option < [ & ' _ mut V ; N ] >
1572
1572
where
1573
- Q : Hash + Equivalent < K > ,
1573
+ Q : Hash + Equivalent < K > + ? Sized ,
1574
1574
{
1575
1575
self . get_many_unchecked_mut_inner ( ks)
1576
1576
. map ( |res| res. map ( |( _, v) | v) )
@@ -1620,12 +1620,12 @@ where
1620
1620
/// ]);
1621
1621
/// assert_eq!(got, None);
1622
1622
/// ```
1623
- pub fn get_many_key_value_mut < Q : ? Sized , const N : usize > (
1623
+ pub fn get_many_key_value_mut < Q , const N : usize > (
1624
1624
& mut self ,
1625
1625
ks : [ & Q ; N ] ,
1626
1626
) -> Option < [ ( & ' _ K , & ' _ mut V ) ; N ] >
1627
1627
where
1628
- Q : Hash + Equivalent < K > ,
1628
+ Q : Hash + Equivalent < K > + ? Sized ,
1629
1629
{
1630
1630
self . get_many_mut_inner ( ks)
1631
1631
. map ( |res| res. map ( |( k, v) | ( & * k, v) ) )
@@ -1675,44 +1675,41 @@ where
1675
1675
/// ]);
1676
1676
/// assert_eq!(got, None);
1677
1677
/// ```
1678
- pub unsafe fn get_many_key_value_unchecked_mut < Q : ? Sized , const N : usize > (
1678
+ pub unsafe fn get_many_key_value_unchecked_mut < Q , const N : usize > (
1679
1679
& mut self ,
1680
1680
ks : [ & Q ; N ] ,
1681
1681
) -> Option < [ ( & ' _ K , & ' _ mut V ) ; N ] >
1682
1682
where
1683
- Q : Hash + Equivalent < K > ,
1683
+ Q : Hash + Equivalent < K > + ? Sized ,
1684
1684
{
1685
1685
self . get_many_unchecked_mut_inner ( ks)
1686
1686
. map ( |res| res. map ( |( k, v) | ( & * k, v) ) )
1687
1687
}
1688
1688
1689
- fn get_many_mut_inner < Q : ?Sized , const N : usize > (
1690
- & mut self ,
1691
- ks : [ & Q ; N ] ,
1692
- ) -> Option < [ & ' _ mut ( K , V ) ; N ] >
1689
+ fn get_many_mut_inner < Q , const N : usize > ( & mut self , ks : [ & Q ; N ] ) -> Option < [ & ' _ mut ( K , V ) ; N ] >
1693
1690
where
1694
- Q : Hash + Equivalent < K > ,
1691
+ Q : Hash + Equivalent < K > + ? Sized ,
1695
1692
{
1696
1693
let hashes = self . build_hashes_inner ( ks) ;
1697
1694
self . table
1698
1695
. get_many_mut ( hashes, |i, ( k, _) | ks[ i] . equivalent ( k) )
1699
1696
}
1700
1697
1701
- unsafe fn get_many_unchecked_mut_inner < Q : ? Sized , const N : usize > (
1698
+ unsafe fn get_many_unchecked_mut_inner < Q , const N : usize > (
1702
1699
& mut self ,
1703
1700
ks : [ & Q ; N ] ,
1704
1701
) -> Option < [ & ' _ mut ( K , V ) ; N ] >
1705
1702
where
1706
- Q : Hash + Equivalent < K > ,
1703
+ Q : Hash + Equivalent < K > + ? Sized ,
1707
1704
{
1708
1705
let hashes = self . build_hashes_inner ( ks) ;
1709
1706
self . table
1710
1707
. get_many_unchecked_mut ( hashes, |i, ( k, _) | ks[ i] . equivalent ( k) )
1711
1708
}
1712
1709
1713
- fn build_hashes_inner < Q : ? Sized , const N : usize > ( & self , ks : [ & Q ; N ] ) -> [ u64 ; N ]
1710
+ fn build_hashes_inner < Q , const N : usize > ( & self , ks : [ & Q ; N ] ) -> [ u64 ; N ]
1714
1711
where
1715
- Q : Hash + Equivalent < K > ,
1712
+ Q : Hash + Equivalent < K > + ? Sized ,
1716
1713
{
1717
1714
let mut hashes = [ 0_u64 ; N ] ;
1718
1715
for i in 0 ..N {
@@ -1892,9 +1889,9 @@ where
1892
1889
/// assert!(map.is_empty());
1893
1890
/// ```
1894
1891
#[ cfg_attr( feature = "inline-more" , inline) ]
1895
- pub fn remove < Q : ? Sized > ( & mut self , k : & Q ) -> Option < V >
1892
+ pub fn remove < Q > ( & mut self , k : & Q ) -> Option < V >
1896
1893
where
1897
- Q : Hash + Equivalent < K > ,
1894
+ Q : Hash + Equivalent < K > + ? Sized ,
1898
1895
{
1899
1896
// Avoid `Option::map` because it bloats LLVM IR.
1900
1897
match self . remove_entry ( k) {
@@ -1931,9 +1928,9 @@ where
1931
1928
/// assert!(map.is_empty());
1932
1929
/// ```
1933
1930
#[ cfg_attr( feature = "inline-more" , inline) ]
1934
- pub fn remove_entry < Q : ? Sized > ( & mut self , k : & Q ) -> Option < ( K , V ) >
1931
+ pub fn remove_entry < Q > ( & mut self , k : & Q ) -> Option < ( K , V ) >
1935
1932
where
1936
- Q : Hash + Equivalent < K > ,
1933
+ Q : Hash + Equivalent < K > + ? Sized ,
1937
1934
{
1938
1935
let hash = make_hash :: < Q , S > ( & self . hash_builder , k) ;
1939
1936
self . table . remove_entry ( hash, equivalent_key ( k) )
@@ -2229,10 +2226,10 @@ where
2229
2226
}
2230
2227
}
2231
2228
2232
- impl < K , Q : ? Sized , V , S , A > Index < & Q > for HashMap < K , V , S , A >
2229
+ impl < K , Q , V , S , A > Index < & Q > for HashMap < K , V , S , A >
2233
2230
where
2234
2231
K : Eq + Hash ,
2235
- Q : Hash + Equivalent < K > ,
2232
+ Q : Hash + Equivalent < K > + ? Sized ,
2236
2233
S : BuildHasher ,
2237
2234
A : Allocator ,
2238
2235
{
@@ -3160,10 +3157,10 @@ impl<'a, K, V, S, A: Allocator> RawEntryBuilderMut<'a, K, V, S, A> {
3160
3157
/// ```
3161
3158
#[ cfg_attr( feature = "inline-more" , inline) ]
3162
3159
#[ allow( clippy:: wrong_self_convention) ]
3163
- pub fn from_key < Q : ? Sized > ( self , k : & Q ) -> RawEntryMut < ' a , K , V , S , A >
3160
+ pub fn from_key < Q > ( self , k : & Q ) -> RawEntryMut < ' a , K , V , S , A >
3164
3161
where
3165
3162
S : BuildHasher ,
3166
- Q : Hash + Equivalent < K > ,
3163
+ Q : Hash + Equivalent < K > + ? Sized ,
3167
3164
{
3168
3165
let hash = make_hash :: < Q , S > ( & self . map . hash_builder , k) ;
3169
3166
self . from_key_hashed_nocheck ( hash, k)
@@ -3193,9 +3190,9 @@ impl<'a, K, V, S, A: Allocator> RawEntryBuilderMut<'a, K, V, S, A> {
3193
3190
/// ```
3194
3191
#[ inline]
3195
3192
#[ allow( clippy:: wrong_self_convention) ]
3196
- pub fn from_key_hashed_nocheck < Q : ? Sized > ( self , hash : u64 , k : & Q ) -> RawEntryMut < ' a , K , V , S , A >
3193
+ pub fn from_key_hashed_nocheck < Q > ( self , hash : u64 , k : & Q ) -> RawEntryMut < ' a , K , V , S , A >
3197
3194
where
3198
- Q : Equivalent < K > ,
3195
+ Q : Equivalent < K > + ? Sized ,
3199
3196
{
3200
3197
self . from_hash ( hash, equivalent ( k) )
3201
3198
}
@@ -3266,10 +3263,10 @@ impl<'a, K, V, S, A: Allocator> RawEntryBuilder<'a, K, V, S, A> {
3266
3263
/// ```
3267
3264
#[ cfg_attr( feature = "inline-more" , inline) ]
3268
3265
#[ allow( clippy:: wrong_self_convention) ]
3269
- pub fn from_key < Q : ? Sized > ( self , k : & Q ) -> Option < ( & ' a K , & ' a V ) >
3266
+ pub fn from_key < Q > ( self , k : & Q ) -> Option < ( & ' a K , & ' a V ) >
3270
3267
where
3271
3268
S : BuildHasher ,
3272
- Q : Hash + Equivalent < K > ,
3269
+ Q : Hash + Equivalent < K > + ? Sized ,
3273
3270
{
3274
3271
let hash = make_hash :: < Q , S > ( & self . map . hash_builder , k) ;
3275
3272
self . from_key_hashed_nocheck ( hash, k)
@@ -3297,9 +3294,9 @@ impl<'a, K, V, S, A: Allocator> RawEntryBuilder<'a, K, V, S, A> {
3297
3294
/// ```
3298
3295
#[ cfg_attr( feature = "inline-more" , inline) ]
3299
3296
#[ allow( clippy:: wrong_self_convention) ]
3300
- pub fn from_key_hashed_nocheck < Q : ? Sized > ( self , hash : u64 , k : & Q ) -> Option < ( & ' a K , & ' a V ) >
3297
+ pub fn from_key_hashed_nocheck < Q > ( self , hash : u64 , k : & Q ) -> Option < ( & ' a K , & ' a V ) >
3301
3298
where
3302
- Q : Equivalent < K > ,
3299
+ Q : Equivalent < K > + ? Sized ,
3303
3300
{
3304
3301
self . from_hash ( hash, equivalent ( k) )
3305
3302
}
@@ -4409,8 +4406,12 @@ where
4409
4406
Vacant ( VacantEntryRef < ' a , ' b , K , Q , V , S , A > ) ,
4410
4407
}
4411
4408
4412
- impl < K : Borrow < Q > , Q : ?Sized + Debug , V : Debug , S , A : Allocator > Debug
4413
- for EntryRef < ' _ , ' _ , K , Q , V , S , A >
4409
+ impl < K , Q , V , S , A > Debug for EntryRef < ' _ , ' _ , K , Q , V , S , A >
4410
+ where
4411
+ K : Borrow < Q > ,
4412
+ Q : Debug + ?Sized ,
4413
+ V : Debug ,
4414
+ A : Allocator ,
4414
4415
{
4415
4416
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
4416
4417
match * self {
@@ -4513,8 +4514,12 @@ where
4513
4514
{
4514
4515
}
4515
4516
4516
- impl < K : Borrow < Q > , Q : ?Sized + Debug , V : Debug , S , A : Allocator > Debug
4517
- for OccupiedEntryRef < ' _ , ' _ , K , Q , V , S , A >
4517
+ impl < K , Q , V , S , A > Debug for OccupiedEntryRef < ' _ , ' _ , K , Q , V , S , A >
4518
+ where
4519
+ K : Borrow < Q > ,
4520
+ Q : Debug + ?Sized ,
4521
+ V : Debug ,
4522
+ A : Allocator ,
4518
4523
{
4519
4524
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
4520
4525
f. debug_struct ( "OccupiedEntryRef" )
@@ -4560,8 +4565,11 @@ pub struct VacantEntryRef<'a, 'b, K, Q: ?Sized, V, S, A: Allocator = Global> {
4560
4565
table : & ' a mut HashMap < K , V , S , A > ,
4561
4566
}
4562
4567
4563
- impl < K : Borrow < Q > , Q : ?Sized + Debug , V , S , A : Allocator > Debug
4564
- for VacantEntryRef < ' _ , ' _ , K , Q , V , S , A >
4568
+ impl < K , Q , V , S , A > Debug for VacantEntryRef < ' _ , ' _ , K , Q , V , S , A >
4569
+ where
4570
+ K : Borrow < Q > ,
4571
+ Q : Debug + ?Sized ,
4572
+ A : Allocator ,
4565
4573
{
4566
4574
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
4567
4575
f. debug_tuple ( "VacantEntryRef" ) . field ( & self . key ( ) ) . finish ( )
0 commit comments