From c3b7b98d6b19bbebf0b5a29689feb9b7162c9864 Mon Sep 17 00:00:00 2001 From: Joe Wilm Date: Tue, 29 May 2018 11:13:49 -0700 Subject: Add assert to Row::grow This enforces the invariant that Row::Grow is only called when the row actually needs to be grown. --- src/grid/row.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/grid/row.rs b/src/grid/row.rs index f7e4a98a..e907b61d 100644 --- a/src/grid/row.rs +++ b/src/grid/row.rs @@ -30,8 +30,10 @@ impl Row { } pub fn grow(&mut self, cols: Column, template: &T) { + assert!(self.len() < * cols); + while self.len() != *cols { - self.push(*template); + self.inner.push(*template); } } -- cgit