summaryrefslogtreecommitdiffstats
path: root/src/grid
diff options
context:
space:
mode:
authorJoe Wilm <joe@jwilm.com>2018-05-29 11:13:49 -0700
committerJoe Wilm <joe@jwilm.com>2018-06-02 09:56:50 -0700
commitc3b7b98d6b19bbebf0b5a29689feb9b7162c9864 (patch)
tree2ed60f2788d062122966daab6387b0a1abd0143e /src/grid
parentdec3ee20e93914976b709634efb63332a9d79ad3 (diff)
Add assert to Row::grow
This enforces the invariant that Row::Grow is only called when the row actually needs to be grown.
Diffstat (limited to 'src/grid')
-rw-r--r--src/grid/row.rs4
1 files changed, 3 insertions, 1 deletions
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<T: Copy + Clone> Row<T> {
}
pub fn grow(&mut self, cols: Column, template: &T) {
+ assert!(self.len() < * cols);
+
while self.len() != *cols {
- self.push(*template);
+ self.inner.push(*template);
}
}