From 9f9f339a75d1a5a534108cd4a060a69201c64fd9 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 14 May 2021 16:00:45 +0200 Subject: [PATCH] :memo: --- zed/src/editor/buffer/rope.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/zed/src/editor/buffer/rope.rs b/zed/src/editor/buffer/rope.rs index 19e4178c39..bc1d672658 100644 --- a/zed/src/editor/buffer/rope.rs +++ b/zed/src/editor/buffer/rope.rs @@ -87,16 +87,11 @@ impl Rope { fn check_invariants(&self) { #[cfg(test)] { + // Ensure all chunks except maybe the last one are not underflowing. let mut chunks = self.chunks.cursor::<(), ()>().peekable(); - chunks.next(); while let Some(chunk) = chunks.next() { if chunks.peek().is_some() { - assert!( - chunk.0.len() >= CHUNK_BASE, - "Underflowing chunk: {:?}\nChunks: {:?}", - chunk, - self.chunks.items() - ); + assert!(chunk.0.len() >= CHUNK_BASE); } } }