File tree Expand file tree Collapse file tree 1 file changed +2
-14
lines changed
Expand file tree Collapse file tree 1 file changed +2
-14
lines changed Original file line number Diff line number Diff line change @@ -432,13 +432,7 @@ unsafe impl<'a> Searcher<'a> for CharSearcher<'a> {
432432 #[inline(always)]
433433 fn next_match(&mut self) -> Option<(usize, usize)> {
434434 if self.utf8_size == 1 {
435- let find = |haystack: &[u8]| {
436- if haystack.len() < 32 {
437- haystack.iter().position(|&x| x == self.utf8_encoded[0])
438- } else {
439- memchr::memchr(self.utf8_encoded[0], haystack)
440- }
441- };
435+ let find = |haystack: &[u8]| memchr::memchr(self.utf8_encoded[0], haystack);
442436 return match find(self.haystack.as_bytes().get(self.finger..self.finger_back)?) {
443437 Some(x) => {
444438 self.finger += x + 1;
@@ -515,13 +509,7 @@ unsafe impl<'a> ReverseSearcher<'a> for CharSearcher<'a> {
515509 #[inline]
516510 fn next_match_back(&mut self) -> Option<(usize, usize)> {
517511 if self.utf8_size == 1 {
518- let find = |haystack: &[u8]| {
519- if haystack.len() < 32 {
520- haystack.iter().rposition(|&x| x == self.utf8_encoded[0])
521- } else {
522- memchr::memrchr(self.utf8_encoded[0], haystack)
523- }
524- };
512+ let find = |haystack: &[u8]| memchr::memrchr(self.utf8_encoded[0], haystack);
525513 return match find(self.haystack.as_bytes().get(self.finger..self.finger_back)?) {
526514 Some(x) => {
527515 self.finger_back = self.finger + x;
You can’t perform that action at this time.
0 commit comments