diff --git a/rm-config/src/keymap/mod.rs b/rm-config/src/keymap/mod.rs index 0f3522c..8502b8f 100644 --- a/rm-config/src/keymap/mod.rs +++ b/rm-config/src/keymap/mod.rs @@ -53,7 +53,7 @@ impl + Ord + UserAction> KeybindsHolder { } keys.entry(&keybinding.action) - .or_insert_with(Vec::new) + .or_default() .push(keybinding.keycode_string()); } diff --git a/rm-main/src/tui/tabs/torrents/mod.rs b/rm-main/src/tui/tabs/torrents/mod.rs index a843f9a..a07abce 100644 --- a/rm-main/src/tui/tabs/torrents/mod.rs +++ b/rm-main/src/tui/tabs/torrents/mod.rs @@ -106,18 +106,16 @@ impl Component for TorrentsTab { return ComponentAction::Nothing; } - if !self.table_manager.selected_torrents_ids.is_empty() { - if action.is_soft_quit() { - self.table_manager - .table - .items - .iter_mut() - .for_each(|t| t.is_selected = false); - self.table_manager.selected_torrents_ids.drain(..); - self.task_manager.default(); - self.ctx.send_action(Action::Render); - return ComponentAction::Nothing; - } + if !self.table_manager.selected_torrents_ids.is_empty() && action.is_soft_quit() { + self.table_manager + .table + .items + .iter_mut() + .for_each(|t| t.is_selected = false); + self.table_manager.selected_torrents_ids.drain(..); + self.task_manager.default(); + self.ctx.send_action(Action::Render); + return ComponentAction::Nothing; } if action.is_quit() { @@ -334,18 +332,16 @@ impl TorrentsTab { .selected_torrents_ids .clone() .into_iter() - .map(|id| Id::Id(id)) + .map(Id::Id) .collect(), )) + } else if let Some(t) = self.table_manager.current_torrent() { + Some(TorrentSelection::Single( + t.id.clone(), + t.torrent_name.to_string(), + )) } else { - if let Some(t) = self.table_manager.current_torrent() { - Some(TorrentSelection::Single( - t.id.clone(), - t.torrent_name.to_string(), - )) - } else { - None - } + None } } diff --git a/rm-main/src/tui/tabs/torrents/task_manager.rs b/rm-main/src/tui/tabs/torrents/task_manager.rs index d1a1ec4..6eacca3 100644 --- a/rm-main/src/tui/tabs/torrents/task_manager.rs +++ b/rm-main/src/tui/tabs/torrents/task_manager.rs @@ -12,10 +12,7 @@ use crate::tui::{ components::{Component, ComponentAction}, }; -use super::{ - rustmission_torrent::RustmissionTorrent, - tasks::{self, CurrentTaskState, TorrentSelection}, -}; +use super::tasks::{self, CurrentTaskState, TorrentSelection}; pub struct TaskManager { ctx: app::Ctx,