File tree Expand file tree Collapse file tree 1 file changed +2
-14
lines changed Expand file tree Collapse file tree 1 file changed +2
-14
lines changed Original file line number Diff line number Diff line change @@ -432,13 +432,7 @@ unsafe impl<'a> Searcher<'a> for CharSearcher<'a> {
432
432
#[ inline( always) ]
433
433
fn next_match ( & mut self ) -> Option < ( usize , usize ) > {
434
434
if self . utf8_size == 1 {
435
- let find = |haystack : & [ u8 ] | {
436
- if haystack. len ( ) < 32 {
437
- haystack. iter ( ) . position ( |& x| x == self . utf8_encoded [ 0 ] )
438
- } else {
439
- memchr:: memchr ( self . utf8_encoded [ 0 ] , haystack)
440
- }
441
- } ;
435
+ let find = |haystack : & [ u8 ] | memchr:: memchr ( self . utf8_encoded [ 0 ] , haystack) ;
442
436
return match find ( self . haystack . as_bytes ( ) . get ( self . finger ..self . finger_back ) ?) {
443
437
Some ( x) => {
444
438
self . finger += x + 1 ;
@@ -515,13 +509,7 @@ unsafe impl<'a> ReverseSearcher<'a> for CharSearcher<'a> {
515
509
#[ inline]
516
510
fn next_match_back ( & mut self ) -> Option < ( usize , usize ) > {
517
511
if self . utf8_size == 1 {
518
- let find = |haystack : & [ u8 ] | {
519
- if haystack. len ( ) < 32 {
520
- haystack. iter ( ) . rposition ( |& x| x == self . utf8_encoded [ 0 ] )
521
- } else {
522
- memchr:: memrchr ( self . utf8_encoded [ 0 ] , haystack)
523
- }
524
- } ;
512
+ let find = |haystack : & [ u8 ] | memchr:: memrchr ( self . utf8_encoded [ 0 ] , haystack) ;
525
513
return match find ( self . haystack . as_bytes ( ) . get ( self . finger ..self . finger_back ) ?) {
526
514
Some ( x) => {
527
515
self . finger_back = self . finger + x;
You can’t perform that action at this time.
0 commit comments