@@ -628,7 +628,7 @@ unsafe impl<'a, 'b> Searcher<'a> for StrSearcher<'a, 'b> {
628
628
}
629
629
}
630
630
631
- #[ inline]
631
+ #[ inline( always ) ]
632
632
fn next_match ( & mut self ) -> Option < ( usize , usize ) > {
633
633
match self . searcher {
634
634
StrSearcherImpl :: Empty ( ..) => {
@@ -642,9 +642,15 @@ unsafe impl<'a, 'b> Searcher<'a> for StrSearcher<'a, 'b> {
642
642
}
643
643
StrSearcherImpl :: TwoWay ( ref mut searcher) => {
644
644
let is_long = searcher. memory == usize:: MAX ;
645
- searcher. next :: < MatchOnly > ( self . haystack . as_bytes ( ) ,
646
- self . needle . as_bytes ( ) ,
647
- is_long)
645
+ if is_long {
646
+ searcher. next :: < MatchOnly > ( self . haystack . as_bytes ( ) ,
647
+ self . needle . as_bytes ( ) ,
648
+ true )
649
+ } else {
650
+ searcher. next :: < MatchOnly > ( self . haystack . as_bytes ( ) ,
651
+ self . needle . as_bytes ( ) ,
652
+ false )
653
+ }
648
654
}
649
655
}
650
656
}
@@ -854,7 +860,7 @@ impl TwoWaySearcher {
854
860
// left to right. If v matches, we try to match u by scanning right to left.
855
861
// How far we can jump when we encounter a mismatch is all based on the fact
856
862
// that (u, v) is a critical factorization for the needle.
857
- #[ inline]
863
+ #[ inline( always ) ]
858
864
fn next < S > ( & mut self , haystack : & [ u8 ] , needle : & [ u8 ] , long_period : bool )
859
865
-> S :: Output
860
866
where S : TwoWayStrategy
0 commit comments