From 4ed25009c49b5963d91f4e3c7ead0f4a5b678980 Mon Sep 17 00:00:00 2001 From: Joe Wilm Date: Thu, 12 Oct 2017 20:29:35 -0700 Subject: Remove some unused methods and impls --- src/grid/mod.rs | 16 ++-------------- src/grid/row.rs | 43 +++++++++++++++++-------------------------- src/term/mod.rs | 7 ++----- 3 files changed, 21 insertions(+), 45 deletions(-) (limited to 'src') diff --git a/src/grid/mod.rs b/src/grid/mod.rs index bd994033..9ca0011a 100644 --- a/src/grid/mod.rs +++ b/src/grid/mod.rs @@ -122,7 +122,7 @@ impl Grid { } fn grow_cols(&mut self, cols: index::Column, template: &T) { - for row in self.lines_mut() { + for row in self.raw.iter_mut() { row.grow(cols, template); } @@ -131,19 +131,7 @@ impl Grid { } - - impl Grid { - #[inline] - pub fn lines(&self) -> vec_deque::Iter> { - self.raw.iter() - } - - #[inline] - pub fn lines_mut(&mut self) -> vec_deque::IterMut> { - self.raw.iter_mut() - } - #[inline] pub fn num_lines(&self) -> index::Line { self.lines @@ -216,7 +204,7 @@ impl Grid { } fn shrink_cols(&mut self, cols: index::Column) { - for row in self.lines_mut() { + for row in self.raw.iter_mut() { row.shrink(cols); } diff --git a/src/grid/row.rs b/src/grid/row.rs index 8711d04f..4b355a56 100644 --- a/src/grid/row.rs +++ b/src/grid/row.rs @@ -108,33 +108,8 @@ impl IndexMut for Row { } } -macro_rules! row_index_range { - ($range:ty) => { - impl Index<$range> for Row { - type Output = [T]; - - #[inline] - fn index(&self, index: $range) -> &[T] { - &self.0[index] - } - } - - impl IndexMut<$range> for Row { - #[inline] - fn index_mut(&mut self, index: $range) -> &mut [T] { - &mut self.0[index] - } - } - } -} - -row_index_range!(Range); -row_index_range!(RangeTo); -row_index_range!(RangeFrom); -row_index_range!(RangeFull); - // ----------------------------------------------------------------------------- -// Column ranges for Row +// Index ranges of columns // ----------------------------------------------------------------------------- impl Index> for Row { @@ -184,3 +159,19 @@ impl IndexMut> for Row { &mut self.0[(index.start.0)..] } } + +impl Index for Row { + type Output = [T]; + + #[inline] + fn index(&self, _: RangeFull) -> &[T] { + &self.0[..] + } +} + +impl IndexMut for Row { + #[inline] + fn index_mut(&mut self, _: RangeFull) -> &mut [T] { + &mut self.0[..] + } +} diff --git a/src/term/mod.rs b/src/term/mod.rs index fa6145f9..c405490e 100644 --- a/src/term/mod.rs +++ b/src/term/mod.rs @@ -1299,11 +1299,8 @@ impl ansi::Handler for Term { let mut template = self.cursor.template; template.c = 'E'; - for row in &mut self.grid.lines_mut() { - for cell in row { - cell.reset(&template); - } - } + self.grid.region_mut(..) + .each(|c| c.reset(&template)); } #[inline] -- cgit