Skip to content

Commit 83b168b

Browse files
author
Ulrik Sverdrup
committed
---
yaml --- r: 227937 b: refs/heads/try c: 274bb24 h: refs/heads/master i: 227935: d303438 v: v3
1 parent 63b0a6d commit 83b168b

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,7 +1,7 @@
11
---
22
refs/heads/master: aca2057ed5fb7af3f8905b2bc01f72fa001c35c8
33
refs/heads/snap-stage3: 1af31d4974e33027a68126fa5a5a3c2c6491824f
4-
refs/heads/try: 71006bd6545015d7ae8e4c18589812bc1f6373dd
4+
refs/heads/try: 274bb24efdbeed0ab1a91f3c02f86551ef16eac7
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/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)