File tree Expand file tree Collapse file tree 2 files changed +4
-7
lines changed Expand file tree Collapse file tree 2 files changed +4
-7
lines changed Original file line number Diff line number Diff line change 1
1
---
2
- refs/heads/master: db3eb7291a3af1b88052f8ad87da79d62bd60b81
2
+ refs/heads/master: 595dd843d7e2e38c08b4e03b79a0531d32d778fb
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
4
refs/heads/snap-stage3: 67c954e365970e4c2cd06f0c50724656d7010f45
5
5
refs/heads/try: 10089455287dcc3652b984ab4bfd6971e1b5f302
Original file line number Diff line number Diff line change @@ -1790,10 +1790,8 @@ impl<'self> StrSlice<'self> for &'self str {
1790
1790
if search.matches(b as char) { return Some(i) }
1791
1791
}
1792
1792
} else {
1793
- let mut index = 0;
1794
- for c in self.iter() {
1793
+ for (index, c) in self.char_offset_iter() {
1795
1794
if search.matches(c) { return Some(index); }
1796
- index += c.len_utf8_bytes();
1797
1795
}
1798
1796
}
1799
1797
@@ -1807,15 +1805,14 @@ impl<'self> StrSlice<'self> for &'self str {
1807
1805
/// `Some` containing the byte index of the last matching character
1808
1806
/// or `None` if there is no match
1809
1807
fn rfind<C: CharEq>(&self, search: C) -> Option<uint> {
1810
- let mut index = self.len();
1811
1808
if search.only_ascii() {
1809
+ let mut index = self.len();
1812
1810
for b in self.byte_rev_iter() {
1813
1811
index -= 1;
1814
1812
if search.matches(b as char) { return Some(index); }
1815
1813
}
1816
1814
} else {
1817
- for c in self.rev_iter() {
1818
- index -= c.len_utf8_bytes();
1815
+ for (index, c) in self.char_offset_rev_iter() {
1819
1816
if search.matches(c) { return Some(index); }
1820
1817
}
1821
1818
}
You can’t perform that action at this time.
0 commit comments