From 8dc258b153f96f8015b71ab2206d2156c5906266 Mon Sep 17 00:00:00 2001 From: Edd Robinson Date: Wed, 22 Apr 2020 12:34:06 +0100 Subject: [PATCH] refactor: improve push --- src/storage/block.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/storage/block.rs b/src/storage/block.rs index cea66a03dc..b5892a01e5 100644 --- a/src/storage/block.rs +++ b/src/storage/block.rs @@ -515,12 +515,8 @@ where Vec: 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; } }