Selaa lähdekoodia

Move assertion in `push` into conditional

Empty blocks might not be well-formed in address, but the assertion hits even though it is empty.
ticki 8 vuotta sitten
vanhempi
commit
e7e3706bca
1 muutettua tiedostoa jossa 4 lisäystä ja 4 poistoa
  1. 4 4
      src/bookkeeper.rs

+ 4 - 4
src/bookkeeper.rs

@@ -624,12 +624,12 @@ pub trait Allocator: ops::DerefMut<Target = Bookkeeper> {
         // Logging.
         log!(self;self.pool.len(), "Pushing {:?}.", block);
 
-        // Some assertions...
-        debug_assert!(self.pool.is_empty() || &block > self.pool.last().unwrap(), "Pushing will \
-                      make the list unsorted.");
-
         // Short-circuit in case on empty block.
         if !block.is_empty() {
+            // Some assertions...
+            debug_assert!(self.pool.is_empty() || &block > self.pool.last().unwrap(), "Pushing will \
+                          make the list unsorted.");
+
             // We will try to simply merge it with the last block.
             if let Some(x) = self.pool.last_mut() {
                 if x.merge_right(&mut block).is_ok() {