From a03971c019f7291a618144280ab12d158f76a4be Mon Sep 17 00:00:00 2001 From: Joscha Date: Wed, 6 Jul 2022 10:14:05 +0200 Subject: [PATCH] Remove unused code --- src/ui/list.rs | 4 ++-- src/ui/rooms.rs | 33 --------------------------------- 2 files changed, 2 insertions(+), 35 deletions(-) diff --git a/src/ui/list.rs b/src/ui/list.rs index fcd5c14..42f14bf 100644 --- a/src/ui/list.rs +++ b/src/ui/list.rs @@ -154,7 +154,7 @@ impl List { pub fn move_cursor_up(&mut self, height: usize, rows: &[Row]) { self.stabilize(height, rows); - self.cursor = if let Some((cid, cidx)) = &self.cursor { + self.cursor = if let Some((_, cidx)) = &self.cursor { Self::selectable_before_index(rows, *cidx).or_else(|| Self::first_selectable(rows)) } else { Self::last_selectable(rows) @@ -167,7 +167,7 @@ impl List { pub fn move_cursor_down(&mut self, height: usize, rows: &[Row]) { self.stabilize(height, rows); - self.cursor = if let Some((cid, cidx)) = &self.cursor { + self.cursor = if let Some((_, cidx)) = &self.cursor { Self::selectable_after_index(rows, *cidx).or_else(|| Self::last_selectable(rows)) } else { Self::first_selectable(rows) diff --git a/src/ui/rooms.rs b/src/ui/rooms.rs index 44631e9..6400e8b 100644 --- a/src/ui/rooms.rs +++ b/src/ui/rooms.rs @@ -18,24 +18,6 @@ use super::list::{List, Row}; use super::room::EuphRoom; use super::{util, UiEvent}; -mod style { - use crossterm::style::{ContentStyle, Stylize}; - - pub fn room() -> ContentStyle { - ContentStyle::default().bold().blue() - } - - pub fn room_inverted() -> ContentStyle { - ContentStyle::default().bold().black().on_white() - } -} - -#[derive(Debug, Default, Clone, Copy)] -struct Cursor { - index: usize, - line: i32, -} - pub struct Rooms { vault: Vault, ui_event_tx: mpsc::UnboundedSender, @@ -59,21 +41,6 @@ impl Rooms { } } - async fn rooms(&self) -> Vec { - let mut rooms = HashSet::new(); - for room in self.vault.euph_rooms().await { - rooms.insert(room); - } - for (name, room) in &self.euph_rooms { - if !room.stopped() { - rooms.insert(name.clone()); - } - } - let mut rooms = rooms.into_iter().collect::>(); - rooms.sort_unstable(); - rooms - } - /// Remove rooms that are not running any more and can't be found in the db. /// /// These kinds of rooms are either