1
- use crate :: TryReserveError ;
1
+ use crate :: { Equivalent , TryReserveError } ;
2
2
use alloc:: borrow:: ToOwned ;
3
- use core:: borrow:: Borrow ;
4
3
use core:: fmt;
5
4
use core:: hash:: { BuildHasher , Hash } ;
6
5
use core:: iter:: { Chain , FromIterator , FusedIterator } ;
@@ -773,8 +772,7 @@ where
773
772
#[ cfg_attr( feature = "inline-more" , inline) ]
774
773
pub fn contains < Q : ?Sized > ( & self , value : & Q ) -> bool
775
774
where
776
- T : Borrow < Q > ,
777
- Q : Hash + Eq ,
775
+ Q : Hash + Equivalent < T > ,
778
776
{
779
777
self . map . contains_key ( value)
780
778
}
@@ -800,8 +798,7 @@ where
800
798
#[ cfg_attr( feature = "inline-more" , inline) ]
801
799
pub fn get < Q : ?Sized > ( & self , value : & Q ) -> Option < & T >
802
800
where
803
- T : Borrow < Q > ,
804
- Q : Hash + Eq ,
801
+ Q : Hash + Equivalent < T > ,
805
802
{
806
803
// Avoid `Option::map` because it bloats LLVM IR.
807
804
match self . map . get_key_value ( value) {
@@ -856,8 +853,7 @@ where
856
853
#[ inline]
857
854
pub fn get_or_insert_owned < Q : ?Sized > ( & mut self , value : & Q ) -> & T
858
855
where
859
- T : Borrow < Q > ,
860
- Q : Hash + Eq + ToOwned < Owned = T > ,
856
+ Q : Hash + Equivalent < T > + ToOwned < Owned = T > ,
861
857
{
862
858
// Although the raw entry gives us `&mut T`, we only return `&T` to be consistent with
863
859
// `get`. Key mutation is "raw" because you're not supposed to affect `Eq` or `Hash`.
@@ -889,8 +885,7 @@ where
889
885
#[ cfg_attr( feature = "inline-more" , inline) ]
890
886
pub fn get_or_insert_with < Q : ?Sized , F > ( & mut self , value : & Q , f : F ) -> & T
891
887
where
892
- T : Borrow < Q > ,
893
- Q : Hash + Eq ,
888
+ Q : Hash + Equivalent < T > ,
894
889
F : FnOnce ( & Q ) -> T ,
895
890
{
896
891
// Although the raw entry gives us `&mut T`, we only return `&T` to be consistent with
@@ -1106,8 +1101,7 @@ where
1106
1101
#[ cfg_attr( feature = "inline-more" , inline) ]
1107
1102
pub fn remove < Q : ?Sized > ( & mut self , value : & Q ) -> bool
1108
1103
where
1109
- T : Borrow < Q > ,
1110
- Q : Hash + Eq ,
1104
+ Q : Hash + Equivalent < T > ,
1111
1105
{
1112
1106
self . map . remove ( value) . is_some ( )
1113
1107
}
@@ -1133,8 +1127,7 @@ where
1133
1127
#[ cfg_attr( feature = "inline-more" , inline) ]
1134
1128
pub fn take < Q : ?Sized > ( & mut self , value : & Q ) -> Option < T >
1135
1129
where
1136
- T : Borrow < Q > ,
1137
- Q : Hash + Eq ,
1130
+ Q : Hash + Equivalent < T > ,
1138
1131
{
1139
1132
// Avoid `Option::map` because it bloats LLVM IR.
1140
1133
match self . map . remove_entry ( value) {
0 commit comments