Skip to content

Commit

Permalink
apply clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
micielski committed Sep 6, 2024
1 parent e402a73 commit 1399401
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 26 deletions.
2 changes: 1 addition & 1 deletion rm-config/src/keymap/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl<T: Into<Action> + Ord + UserAction> KeybindsHolder<T> {
}

keys.entry(&keybinding.action)
.or_insert_with(Vec::new)
.or_default()
.push(keybinding.keycode_string());
}

Expand Down
38 changes: 17 additions & 21 deletions rm-main/src/tui/tabs/torrents/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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
}
}

Expand Down
5 changes: 1 addition & 4 deletions rm-main/src/tui/tabs/torrents/task_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 1399401

Please sign in to comment.