Skip to content

Commit 1cfeb34

Browse files
author
Ulrik Sverdrup
committed
---
yaml --- r: 217555 b: refs/heads/tmp c: 274bb24 h: refs/heads/master i: 217553: fb680d9 217551: 23b011d v: v3
1 parent a402837 commit 1cfeb34

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
2626
refs/heads/beta: 2ad26e850ed5dfedda8c96d7315aee50145ceedd
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
28-
refs/heads/tmp: 71006bd6545015d7ae8e4c18589812bc1f6373dd
28+
refs/heads/tmp: 274bb24efdbeed0ab1a91f3c02f86551ef16eac7
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: a5286998df566e736b32f6795bfc3803bdaf453d
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828

branches/tmp/src/libcore/str/pattern.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ unsafe impl<'a, 'b> Searcher<'a> for StrSearcher<'a, 'b> {
628628
}
629629
}
630630

631-
#[inline]
631+
#[inline(always)]
632632
fn next_match(&mut self) -> Option<(usize, usize)> {
633633
match self.searcher {
634634
StrSearcherImpl::Empty(..) => {
@@ -642,9 +642,15 @@ unsafe impl<'a, 'b> Searcher<'a> for StrSearcher<'a, 'b> {
642642
}
643643
StrSearcherImpl::TwoWay(ref mut searcher) => {
644644
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+
}
648654
}
649655
}
650656
}
@@ -854,7 +860,7 @@ impl TwoWaySearcher {
854860
// left to right. If v matches, we try to match u by scanning right to left.
855861
// How far we can jump when we encounter a mismatch is all based on the fact
856862
// that (u, v) is a critical factorization for the needle.
857-
#[inline]
863+
#[inline(always)]
858864
fn next<S>(&mut self, haystack: &[u8], needle: &[u8], long_period: bool)
859865
-> S::Output
860866
where S: TwoWayStrategy

0 commit comments

Comments
 (0)