@@ -915,23 +915,10 @@ impl<T, A: Allocator + Clone> RawTable<T, A> {
915915 /// Searches for an element in the table,
916916 /// or a potential slot where that element could be inserted.
917917 #[ inline]
918- pub fn find_potential (
919- & self ,
920- hash : u64 ,
921- mut eq : impl FnMut ( & T ) -> bool ,
922- ) -> Result < Bucket < T > , usize > {
923- unsafe {
924- let result = self . table . find_potential_inner ( hash, & mut |index| {
925- let bucket = self . bucket ( index) ;
926- let elm = bucket. as_ref ( ) ;
927- eq ( elm)
928- } ) ;
929-
930- match result {
931- Ok ( index) => Ok ( self . bucket ( index) ) ,
932- Err ( index) => Err ( index) ,
933- }
934- }
918+ pub fn find_potential ( & self , hash : u64 , mut eq : impl FnMut ( & T ) -> bool ) -> ( usize , bool ) {
919+ self . table . find_potential_inner ( hash, & mut |index| unsafe {
920+ eq ( self . bucket ( index) . as_ref ( ) )
921+ } )
935922 }
936923
937924 /// Inserts an element in the table at a potential slot as returned by `find_potential`.
@@ -1224,12 +1211,12 @@ impl<A: Allocator + Clone> RawTableInner<A> {
12241211 /// Searches for an element in the table, stopping at the group where `stop` returns `Some` and
12251212 /// no elements matched. Returns the bucket that matches or the result of `stop`.
12261213 #[ inline]
1227- unsafe fn search < R > (
1214+ unsafe fn search (
12281215 & self ,
12291216 hash : u64 ,
12301217 eq : & mut dyn FnMut ( usize ) -> bool ,
1231- mut stop : impl FnMut ( & Group , & ProbeSeq ) -> Option < R > ,
1232- ) -> Result < usize , R > {
1218+ mut stop : impl FnMut ( & Group , & ProbeSeq ) -> Option < usize > ,
1219+ ) -> ( usize , bool ) {
12331220 let h2_hash = h2 ( hash) ;
12341221 let mut probe_seq = self . probe_seq ( hash) ;
12351222
@@ -1240,12 +1227,12 @@ impl<A: Allocator + Clone> RawTableInner<A> {
12401227 let index = ( probe_seq. pos + bit) & self . bucket_mask ;
12411228
12421229 if likely ( eq ( index) ) {
1243- return Ok ( index) ;
1230+ return ( index, true ) ;
12441231 }
12451232 }
12461233
12471234 if let Some ( stop) = stop ( & group, & probe_seq) {
1248- return Err ( stop) ;
1235+ return ( stop, false ) ;
12491236 }
12501237
12511238 probe_seq. move_next ( self . bucket_mask ) ;
@@ -1295,7 +1282,7 @@ impl<A: Allocator + Clone> RawTableInner<A> {
12951282 & self ,
12961283 hash : u64 ,
12971284 eq : & mut dyn FnMut ( usize ) -> bool ,
1298- ) -> Result < usize , usize > {
1285+ ) -> ( usize , bool ) {
12991286 unsafe {
13001287 let mut tombstone = None ;
13011288 self . search ( hash, eq, |group, probe_seq| {
0 commit comments