diff options
author | Joe Wilm <joe@jwilm.com> | 2018-05-29 11:13:49 -0700 |
---|---|---|
committer | Joe Wilm <joe@jwilm.com> | 2018-05-29 11:13:49 -0700 |
commit | 26fd7b858dcab08120a1749f6ef4307d748b3ec6 (patch) | |
tree | 1a7223d89cf5c1368a1cd39fabed9b5e4c93828d /src | |
parent | 439644f3bf0681f120b3583be7a3d3386cb45db9 (diff) | |
download | alacritty-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.rs | 4 |
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); } } |