diff options
author | Joe Wilm <joe@jwilm.com> | 2018-05-29 11:13:49 -0700 |
---|---|---|
committer | Joe Wilm <joe@jwilm.com> | 2018-06-02 09:56:50 -0700 |
commit | c3b7b98d6b19bbebf0b5a29689feb9b7162c9864 (patch) | |
tree | 2ed60f2788d062122966daab6387b0a1abd0143e | |
parent | dec3ee20e93914976b709634efb63332a9d79ad3 (diff) | |
download | alacritty-c3b7b98d6b19bbebf0b5a29689feb9b7162c9864.tar.gz alacritty-c3b7b98d6b19bbebf0b5a29689feb9b7162c9864.zip |
Add assert to Row::grow
This enforces the invariant that Row::Grow is only called when the row
actually needs to be grown.
-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); } } |