This commit is contained in:
Antonio Scandurra 2021-05-14 16:00:45 +02:00
parent e2c19d3d3f
commit 9f9f339a75

View file

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