From 9f210e973834700d14c6c0283ed750ed5b038e8b Mon Sep 17 00:00:00 2001 From: Ogulcan Celik Date: Sat, 9 May 2026 23:16:24 +0300 Subject: chore: enable clippy linting --- src/app/input/mod.rs | 21 +++++++++++++-------- src/app/input/modal.rs | 12 +++++------- src/app/input/settings.rs | 24 ++++++++++++++++-------- 3 files changed, 34 insertions(+), 23 deletions(-) (limited to 'src/app/input') diff --git a/src/app/input/mod.rs b/src/app/input/mod.rs index 56ad09a9..aa607c78 100644 --- a/src/app/input/mod.rs +++ b/src/app/input/mod.rs @@ -92,10 +92,13 @@ impl App { pub(crate) fn handle_onboarding_key(&mut self, key: KeyEvent) { match key.code { KeyCode::Right | KeyCode::Char('l') => self.open_settings_from_onboarding(), - _ => match modal_action_from_key(&key, ONBOARDING_WELCOME_ACTIONS) { - Some(ModalAction::Continue) => self.open_settings_from_onboarding(), - _ => {} - }, + _ => { + if let Some(ModalAction::Continue) = + modal_action_from_key(&key, ONBOARDING_WELCOME_ACTIONS) + { + self.open_settings_from_onboarding(); + } + } } } @@ -116,10 +119,12 @@ impl App { notes.scroll = max_scroll; } } - _ => match modal_action_from_key(&key, RELEASE_NOTES_ACTIONS) { - Some(ModalAction::Close) => self.dismiss_release_notes(), - _ => {} - }, + _ => { + if let Some(ModalAction::Close) = modal_action_from_key(&key, RELEASE_NOTES_ACTIONS) + { + self.dismiss_release_notes(); + } + } } } diff --git a/src/app/input/modal.rs b/src/app/input/modal.rs index 998bb69b..a76576bf 100644 --- a/src/app/input/modal.rs +++ b/src/app/input/modal.rs @@ -261,13 +261,11 @@ pub(super) fn apply_rename_action(state: &mut AppState, action: ModalAction) { state.name_input.trim().to_string() }; match state.mode { - Mode::RenameWorkspace if !state.workspaces.is_empty() => { - if !new_name.is_empty() { - let workspace_id = state.workspaces[state.selected].id.clone(); - state.workspaces[state.selected].set_custom_name(new_name); - crate::logging::workspace_renamed(&workspace_id); - state.mark_session_dirty(); - } + Mode::RenameWorkspace if !state.workspaces.is_empty() && !new_name.is_empty() => { + let workspace_id = state.workspaces[state.selected].id.clone(); + state.workspaces[state.selected].set_custom_name(new_name); + crate::logging::workspace_renamed(&workspace_id); + state.mark_session_dirty(); } Mode::RenameTab if state.creating_new_tab => { state.request_new_tab = true; diff --git a/src/app/input/settings.rs b/src/app/input/settings.rs index 2c92bc63..67144a28 100644 --- a/src/app/input/settings.rs +++ b/src/app/input/settings.rs @@ -10,6 +10,8 @@ use crate::{ }; #[derive(Debug, Clone, PartialEq, Eq)] +// The shared `Save` verb is semantic: these actions persist settings. +#[allow(clippy::enum_variant_names)] pub(super) enum SettingsAction { SaveTheme(String), SaveSound(bool), @@ -135,10 +137,13 @@ pub(super) fn update_settings_state(state: &mut AppState, key: KeyEvent) -> Opti state.settings.section = SettingsSection::Theme; state.settings.list.selected = current_theme_index(&state.theme_name); } - _ => match super::modal::modal_action_from_key(&key, super::modal::SETTINGS_ACTIONS) { - Some(super::modal::ModalAction::Close) => cancel_settings(state), - _ => {} - }, + _ => { + if let Some(super::modal::ModalAction::Close) = + super::modal::modal_action_from_key(&key, super::modal::SETTINGS_ACTIONS) + { + cancel_settings(state); + } + } }, SettingsSection::Toast => match key.code { KeyCode::Up | KeyCode::Char('k') => state.settings.list.move_prev(), @@ -155,10 +160,13 @@ pub(super) fn update_settings_state(state: &mut AppState, key: KeyEvent) -> Opti state.settings.section = SettingsSection::Theme; state.settings.list.selected = current_theme_index(&state.theme_name); } - _ => match super::modal::modal_action_from_key(&key, super::modal::SETTINGS_ACTIONS) { - Some(super::modal::ModalAction::Close) => cancel_settings(state), - _ => {} - }, + _ => { + if let Some(super::modal::ModalAction::Close) = + super::modal::modal_action_from_key(&key, super::modal::SETTINGS_ACTIONS) + { + cancel_settings(state); + } + } }, } -- cgit v1.2.3