Removed redundant bounds checking at Split's next and next_mut methods
This commit is contained in:
parent
e87ccb8676
commit
b15e13760a
1 changed files with 4 additions and 4 deletions
|
@ -458,8 +458,8 @@ where
|
|||
match self.v.iter().position(|x| (self.pred)(x)) {
|
||||
None => self.finish(),
|
||||
Some(idx) => {
|
||||
let ret = Some(&self.v[..idx]);
|
||||
self.v = &self.v[idx + 1..];
|
||||
let ret = Some(unsafe { self.v.get_unchecked(..idx) });
|
||||
self.v = unsafe { self.v.get_unchecked(idx + 1..) };
|
||||
ret
|
||||
}
|
||||
}
|
||||
|
@ -491,8 +491,8 @@ where
|
|||
match self.v.iter().rposition(|x| (self.pred)(x)) {
|
||||
None => self.finish(),
|
||||
Some(idx) => {
|
||||
let ret = Some(&self.v[idx + 1..]);
|
||||
self.v = &self.v[..idx];
|
||||
let ret = Some(unsafe { self.v.get_unchecked(idx + 1..) });
|
||||
self.v = unsafe { self.v.get_unchecked(..idx) };
|
||||
ret
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue