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); } } }