mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 06:51:58 +00:00
SplitInternal: always set finished
in get_end
This commit is contained in:
parent
c5351ad4dc
commit
ca4989eac2
@ -585,17 +585,18 @@ where
|
||||
impl<'a, P: Pattern<'a>> SplitInternal<'a, P> {
|
||||
#[inline]
|
||||
fn get_end(&mut self) -> Option<&'a str> {
|
||||
if !self.finished && (self.allow_trailing_empty || self.end - self.start > 0) {
|
||||
if !self.finished {
|
||||
self.finished = true;
|
||||
|
||||
if self.allow_trailing_empty || self.end - self.start > 0 {
|
||||
// SAFETY: `self.start` and `self.end` always lie on unicode boundaries.
|
||||
unsafe {
|
||||
let string = self.matcher.haystack().get_unchecked(self.start..self.end);
|
||||
Some(string)
|
||||
let string = unsafe { self.matcher.haystack().get_unchecked(self.start..self.end) };
|
||||
return Some(string);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn next(&mut self) -> Option<&'a str> {
|
||||
|
Loading…
Reference in New Issue
Block a user