diff options
| author | Andre Bogus <bogusandre@gmail.com> | 2019-12-11 20:49:46 +0100 |
|---|---|---|
| committer | Andre Bogus <bogusandre@gmail.com> | 2019-12-11 20:49:46 +0100 |
| commit | 7f87dd1bc008d49cc27bee8d5a866e3c2de463b3 (patch) | |
| tree | 1951551190e515820d1b6a87da95c0f076fd54f4 /src/libcore/str/pattern.rs | |
| parent | 90b957a17c1abba979aa41234ce0993a61030e67 (diff) | |
| download | rust-7f87dd1bc008d49cc27bee8d5a866e3c2de463b3.tar.gz rust-7f87dd1bc008d49cc27bee8d5a866e3c2de463b3.zip | |
Some small readability improvements
Diffstat (limited to 'src/libcore/str/pattern.rs')
| -rw-r--r-- | src/libcore/str/pattern.rs | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/src/libcore/str/pattern.rs b/src/libcore/str/pattern.rs index a494274118a..1037da14b5f 100644 --- a/src/libcore/str/pattern.rs +++ b/src/libcore/str/pattern.rs @@ -296,12 +296,7 @@ unsafe impl<'a> Searcher<'a> for CharSearcher<'a> { fn next_match(&mut self) -> Option<(usize, usize)> { loop { // get the haystack after the last character found - let bytes = if let Some(slice) = self.haystack.as_bytes() - .get(self.finger..self.finger_back) { - slice - } else { - return None; - }; + let bytes = self.haystack.as_bytes().get(self.finger..self.finger_back)?; // the last byte of the utf8 encoded needle let last_byte = unsafe { *self.utf8_encoded.get_unchecked(self.utf8_size - 1) }; if let Some(index) = memchr::memchr(last_byte, bytes) { |
