Skip to content

Commit c577670

Browse files
author
Ulrik Sverdrup
committed
---
yaml --- r: 219695 b: refs/heads/snap-stage3 c: 274bb24 h: refs/heads/master i: 219693: a251794 219691: 76af9dc 219687: 934d600 219679: 4ecb4f0 v: v3
1 parent 61e114d commit c577670

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
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: c044791d80ea0dc5c4b57b6030a67b69f8510239
3-
refs/heads/snap-stage3: 71006bd6545015d7ae8e4c18589812bc1f6373dd
3+
refs/heads/snap-stage3: 274bb24efdbeed0ab1a91f3c02f86551ef16eac7
44
refs/heads/try: b53c0f93eedcdedd4fd89bccc5a3a09d1c5cd23e
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/snap-stage3/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)