refactor: improve push

pull/24376/head
Edd Robinson 2020-04-22 12:34:06 +01:00
parent 138c54b1a9
commit 8dc258b153
1 changed files with 2 additions and 6 deletions

View File

@ -515,12 +515,8 @@ where
Vec<T>: Encoder,
{
fn push(&mut self, values: &[(i64, T)]) {
if values.is_empty() {
return;
}
if let Some(last) = self.values.last() {
if last.0 > values.first().unwrap().0 {
if let (Some((new_first, _)), Some((old_last, _))) = (values.first(), self.values.last()) {
if old_last > new_first {
self.sorted = false;
}
}