@@ -362,22 +362,22 @@ impl<'c> RegularExpression for ExecNoSyncStr<'c> {
362
362
next_utf8 ( text. as_bytes ( ) , i)
363
363
}
364
364
365
- #[ inline( always) ] // reduces constant overhead
365
+ #[ cfg_attr ( feature = "perf- inline" , inline ( always) ) ]
366
366
fn shortest_match_at ( & self , text : & str , start : usize ) -> Option < usize > {
367
367
self . 0 . shortest_match_at ( text. as_bytes ( ) , start)
368
368
}
369
369
370
- #[ inline( always) ] // reduces constant overhead
370
+ #[ cfg_attr ( feature = "perf- inline" , inline ( always) ) ]
371
371
fn is_match_at ( & self , text : & str , start : usize ) -> bool {
372
372
self . 0 . is_match_at ( text. as_bytes ( ) , start)
373
373
}
374
374
375
- #[ inline( always) ] // reduces constant overhead
375
+ #[ cfg_attr ( feature = "perf- inline" , inline ( always) ) ]
376
376
fn find_at ( & self , text : & str , start : usize ) -> Option < ( usize , usize ) > {
377
377
self . 0 . find_at ( text. as_bytes ( ) , start)
378
378
}
379
379
380
- #[ inline( always) ] // reduces constant overhead
380
+ #[ cfg_attr ( feature = "perf- inline" , inline ( always) ) ]
381
381
fn captures_read_at (
382
382
& self ,
383
383
locs : & mut Locations ,
@@ -404,7 +404,7 @@ impl<'c> RegularExpression for ExecNoSync<'c> {
404
404
405
405
/// Returns the end of a match location, possibly occurring before the
406
406
/// end location of the correct leftmost-first match.
407
- #[ inline( always) ] // reduces constant overhead
407
+ #[ cfg_attr ( feature = "perf- inline" , inline ( always) ) ]
408
408
fn shortest_match_at ( & self , text : & [ u8 ] , start : usize ) -> Option < usize > {
409
409
if !self . is_anchor_end_match ( text) {
410
410
return None ;
@@ -449,7 +449,7 @@ impl<'c> RegularExpression for ExecNoSync<'c> {
449
449
///
450
450
/// For single regular expressions, this is equivalent to calling
451
451
/// shortest_match(...).is_some().
452
- #[ inline( always) ] // reduces constant overhead
452
+ #[ cfg_attr ( feature = "perf- inline" , inline ( always) ) ]
453
453
fn is_match_at ( & self , text : & [ u8 ] , start : usize ) -> bool {
454
454
if !self . is_anchor_end_match ( text) {
455
455
return false ;
@@ -495,7 +495,7 @@ impl<'c> RegularExpression for ExecNoSync<'c> {
495
495
496
496
/// Finds the start and end location of the leftmost-first match, starting
497
497
/// at the given location.
498
- #[ inline( always) ] // reduces constant overhead
498
+ #[ cfg_attr ( feature = "perf- inline" , inline ( always) ) ]
499
499
fn find_at ( & self , text : & [ u8 ] , start : usize ) -> Option < ( usize , usize ) > {
500
500
if !self . is_anchor_end_match ( text) {
501
501
return None ;
@@ -639,7 +639,7 @@ impl<'c> RegularExpression for ExecNoSync<'c> {
639
639
640
640
impl < ' c > ExecNoSync < ' c > {
641
641
/// Finds the leftmost-first match using only literal search.
642
- #[ inline( always) ] // reduces constant overhead
642
+ #[ cfg_attr ( feature = "perf- inline" , inline ( always) ) ]
643
643
fn find_literals (
644
644
& self ,
645
645
ty : MatchLiteralType ,
@@ -682,7 +682,7 @@ impl<'c> ExecNoSync<'c> {
682
682
///
683
683
/// If the result returned indicates that the DFA quit, then another
684
684
/// matching engine should be used.
685
- #[ inline( always) ] // reduces constant overhead
685
+ #[ cfg_attr ( feature = "perf- inline" , inline ( always) ) ]
686
686
fn find_dfa_forward (
687
687
& self ,
688
688
text : & [ u8 ] ,
@@ -721,7 +721,7 @@ impl<'c> ExecNoSync<'c> {
721
721
///
722
722
/// If the result returned indicates that the DFA quit, then another
723
723
/// matching engine should be used.
724
- #[ inline( always) ] // reduces constant overhead
724
+ #[ cfg_attr ( feature = "perf- inline" , inline ( always) ) ]
725
725
fn find_dfa_anchored_reverse (
726
726
& self ,
727
727
text : & [ u8 ] ,
@@ -742,15 +742,15 @@ impl<'c> ExecNoSync<'c> {
742
742
}
743
743
744
744
/// Finds the end of the shortest match using only the DFA.
745
- #[ inline( always) ] // reduces constant overhead
745
+ #[ cfg_attr ( feature = "perf- inline" , inline ( always) ) ]
746
746
fn shortest_dfa ( & self , text : & [ u8 ] , start : usize ) -> dfa:: Result < usize > {
747
747
dfa:: Fsm :: forward ( & self . ro . dfa , self . cache , true , text, start)
748
748
}
749
749
750
750
/// Finds the end of the shortest match using only the DFA by scanning for
751
751
/// suffix literals.
752
752
///
753
- #[ inline( always) ] // reduces constant overhead
753
+ #[ cfg_attr ( feature = "perf- inline" , inline ( always) ) ]
754
754
fn shortest_dfa_reverse_suffix (
755
755
& self ,
756
756
text : & [ u8 ] ,
@@ -775,7 +775,7 @@ impl<'c> ExecNoSync<'c> {
775
775
///
776
776
/// If the result returned indicates that the DFA quit, then another
777
777
/// matching engine should be used.
778
- #[ inline( always) ] // reduces constant overhead
778
+ #[ cfg_attr ( feature = "perf- inline" , inline ( always) ) ]
779
779
fn exec_dfa_reverse_suffix (
780
780
& self ,
781
781
text : & [ u8 ] ,
@@ -819,7 +819,7 @@ impl<'c> ExecNoSync<'c> {
819
819
///
820
820
/// If the result returned indicates that the DFA quit, then another
821
821
/// matching engine should be used.
822
- #[ inline( always) ] // reduces constant overhead
822
+ #[ cfg_attr ( feature = "perf- inline" , inline ( always) ) ]
823
823
fn find_dfa_reverse_suffix (
824
824
& self ,
825
825
text : & [ u8 ] ,
@@ -1118,7 +1118,7 @@ impl<'c> ExecNoSync<'c> {
1118
1118
}
1119
1119
}
1120
1120
1121
- #[ inline( always) ] // reduces constant overhead
1121
+ #[ cfg_attr ( feature = "perf- inline" , inline ( always) ) ]
1122
1122
fn is_anchor_end_match ( & self , text : & [ u8 ] ) -> bool {
1123
1123
// Only do this check if the haystack is big (>1MB).
1124
1124
if text. len ( ) > ( 1 << 20 ) && self . ro . nfa . is_anchored_end {
@@ -1143,7 +1143,7 @@ impl<'c> ExecNoSyncStr<'c> {
1143
1143
1144
1144
impl Exec {
1145
1145
/// Get a searcher that isn't Sync.
1146
- #[ inline( always) ] // reduces constant overhead
1146
+ #[ cfg_attr ( feature = "perf- inline" , inline ( always) ) ]
1147
1147
pub fn searcher ( & self ) -> ExecNoSync {
1148
1148
let create =
1149
1149
|| Box :: new ( RefCell :: new ( ProgramCacheInner :: new ( & self . ro ) ) ) ;
@@ -1154,7 +1154,7 @@ impl Exec {
1154
1154
}
1155
1155
1156
1156
/// Get a searcher that isn't Sync and can match on &str.
1157
- #[ inline( always) ] // reduces constant overhead
1157
+ #[ cfg_attr ( feature = "perf- inline" , inline ( always) ) ]
1158
1158
pub fn searcher_str ( & self ) -> ExecNoSyncStr {
1159
1159
ExecNoSyncStr ( self . searcher ( ) )
1160
1160
}
0 commit comments