ci: add GitHub Actions workflows with semantic-release auto-versioning
chore: fix all 702 clippy warnings across codebase - auto-fix 475 via cargo clippy --fix - fix remaining 227 manually: uninlined_format_args, redundant_closure, match_same_arms, underscore_binding, format_push_string, items_after_statements, needless_pass_by_value, clone_on_copy, case_sensitive_extension, single_match/let-else, write_with_newline, and other clippy lints
This commit is contained in:
@@ -87,7 +87,7 @@ pub fn parse_command(text: &str) -> Command {
|
||||
mode: arg1.to_string(),
|
||||
}
|
||||
}
|
||||
"/pipeline" => Command::Unknown(format!("/pipeline {} (use: full|quick|skip)", arg1)),
|
||||
"/pipeline" => Command::Unknown(format!("/pipeline {arg1} (use: full|quick|skip)")),
|
||||
_ => Command::Unknown(cmd.to_string()),
|
||||
}
|
||||
}
|
||||
|
||||
+11
-20
@@ -21,6 +21,7 @@ use crate::controller::command::parse_command;
|
||||
/// Why: when Editor overlay is active, all key events are consumed by the
|
||||
/// editor handler and never reach the main action dispatch. Return `Vec`
|
||||
/// so that a single key press can trigger multiple actions.
|
||||
#[allow(clippy::too_many_lines)]
|
||||
pub fn handle_key(key: KeyEvent, state: &mut AppStateRest) -> Vec<Action> {
|
||||
// While Editor overlay is active, route input directly to the editor handler
|
||||
if state.misc.overlay == Overlay::Editor {
|
||||
@@ -34,7 +35,7 @@ pub fn handle_key(key: KeyEvent, state: &mut AppStateRest) -> Vec<Action> {
|
||||
if let Err(e) = std::fs::write(&ed.path, &content) {
|
||||
state.push_toast(crate::app::state::types::Toast::new(
|
||||
crate::app::state::types::ToastKind::Error,
|
||||
format!("Save failed: {}", e),
|
||||
format!("Save failed: {e}"),
|
||||
));
|
||||
} else {
|
||||
state.push_toast(crate::app::state::types::Toast::new(
|
||||
@@ -58,11 +59,11 @@ pub fn handle_key(key: KeyEvent, state: &mut AppStateRest) -> Vec<Action> {
|
||||
return vec![];
|
||||
}
|
||||
KeyCode::Enter => {
|
||||
crate::app::mode::editor::handle_editor_input(state, "\n".to_string());
|
||||
crate::app::mode::editor::handle_editor_input(state, "\n");
|
||||
return vec![];
|
||||
}
|
||||
KeyCode::Char(c) => {
|
||||
crate::app::mode::editor::handle_editor_input(state, c.to_string());
|
||||
crate::app::mode::editor::handle_editor_input(state, &c.to_string());
|
||||
return vec![];
|
||||
}
|
||||
_ => return vec![],
|
||||
@@ -93,25 +94,15 @@ pub fn handle_key(key: KeyEvent, state: &mut AppStateRest) -> Vec<Action> {
|
||||
}
|
||||
KeyCode::Enter | KeyCode::Char('a') => {
|
||||
let items = crate::app::mode::learning::get_learning_items(state);
|
||||
if let Some(item) = items.get(state.misc.selected_index) {
|
||||
match item {
|
||||
crate::app::mode::learning::LearningItem::Pending { name, .. } => {
|
||||
return vec![Action::LessonAccept { name: name.clone() }];
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
if let Some(crate::app::mode::learning::LearningItem::Pending { name, .. }) = items.get(state.misc.selected_index) {
|
||||
return vec![Action::LessonAccept { name: name.clone() }];
|
||||
}
|
||||
return vec![];
|
||||
}
|
||||
KeyCode::Char('r') => {
|
||||
let items = crate::app::mode::learning::get_learning_items(state);
|
||||
if let Some(item) = items.get(state.misc.selected_index) {
|
||||
match item {
|
||||
crate::app::mode::learning::LearningItem::Pending { name, .. } => {
|
||||
return vec![Action::LessonReject { name: name.clone() }];
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
if let Some(crate::app::mode::learning::LearningItem::Pending { name, .. }) = items.get(state.misc.selected_index) {
|
||||
return vec![Action::LessonReject { name: name.clone() }];
|
||||
}
|
||||
return vec![];
|
||||
}
|
||||
@@ -341,8 +332,8 @@ fn handle_overlay_enter(state: &mut AppStateRest) -> Vec<Action> {
|
||||
tracing::warn!("[input] provider '{}' has no default_model, using 'claude-opus-4-8'", provider);
|
||||
"claude-opus-4-8".to_string()
|
||||
});
|
||||
state.settings.provider = provider.clone();
|
||||
state.settings.model = model.clone();
|
||||
state.settings.provider.clone_from(provider);
|
||||
state.settings.model.clone_from(&model);
|
||||
if let Some(ref key) = cfg.default_api_key {
|
||||
state.settings.api_keys.insert(provider.clone(), key.clone());
|
||||
} else if let Some(env_key) = cfg.api_key_env.as_ref().and_then(|env| std::env::var(env).ok()) {
|
||||
@@ -351,7 +342,7 @@ fn handle_overlay_enter(state: &mut AppStateRest) -> Vec<Action> {
|
||||
let _ = state.settings.save();
|
||||
state.push_toast(crate::app::state::types::Toast::new(
|
||||
crate::app::state::types::ToastKind::Success,
|
||||
format!("Switched to {} / {}", provider, model),
|
||||
format!("Switched to {provider} / {model}"),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user