aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoe Wilm <joe@jwilm.com>2018-05-29 11:13:49 -0700
committerJoe Wilm <joe@jwilm.com>2018-05-29 11:13:49 -0700
commit26fd7b858dcab08120a1749f6ef4307d748b3ec6 (patch)
tree1a7223d89cf5c1368a1cd39fabed9b5e4c93828d /src
parent439644f3bf0681f120b3583be7a3d3386cb45db9 (diff)
downloadalacritty-26fd7b858dcab08120a1749f6ef4307d748b3ec6.tar.gz
alacritty-26fd7b858dcab08120a1749f6ef4307d748b3ec6.zip
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')
-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);
}
}