From 5092f6755712a31004409d856b9984d5097572d3 Mon Sep 17 00:00:00 2001 From: Hunter Bown Date: Wed, 21 Jan 2026 22:46:07 -0600 Subject: [PATCH] fix: resolve clippy warnings for Rust 1.92 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Use strip_prefix instead of manual string slicing in apply_patch.rs - Use vec![] macro instead of Vec::new() + push in api_key.rs - Fix iter_overeager_cloned by filtering before cloning in session_picker.rs - Use ? operator instead of let...else in delete_selected - Allow clippy::too_many_arguments for build_list_lines 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- .deepseek/trusted | 0 src/tools/apply_patch.rs | 8 ++++---- src/tui/onboarding/api_key.rs | 35 ++++++++++++++++++----------------- src/tui/session_picker.rs | 7 +++---- 4 files changed, 25 insertions(+), 25 deletions(-) create mode 100644 .deepseek/trusted diff --git a/.deepseek/trusted b/.deepseek/trusted new file mode 100644 index 00000000..e69de29b diff --git a/src/tools/apply_patch.rs b/src/tools/apply_patch.rs index bfbafce2..768bbc25 100644 --- a/src/tools/apply_patch.rs +++ b/src/tools/apply_patch.rs @@ -264,13 +264,13 @@ fn parse_unified_diff_files( continue; } - if line.starts_with("--- ") { - old_path = Some(line[4..].trim().to_string()); + if let Some(stripped) = line.strip_prefix("--- ") { + old_path = Some(stripped.trim().to_string()); continue; } - if line.starts_with("+++ ") { - let new_path = Some(line[4..].trim().to_string()); + if let Some(stripped) = line.strip_prefix("+++ ") { + let new_path = Some(stripped.trim().to_string()); let (path, delete_after, create_flag) = resolve_diff_paths(old_path.as_deref(), new_path.as_deref(), create_if_missing)?; if let Some(file) = current.take() { diff --git a/src/tui/onboarding/api_key.rs b/src/tui/onboarding/api_key.rs index 6e410fb5..df89b49f 100644 --- a/src/tui/onboarding/api_key.rs +++ b/src/tui/onboarding/api_key.rs @@ -7,23 +7,24 @@ use crate::palette; use crate::tui::app::App; pub fn lines(app: &App) -> Vec> { - let mut lines = Vec::new(); - lines.push(Line::from(Span::styled( - "API Key Setup", - Style::default() - .fg(palette::DEEPSEEK_SKY) - .add_modifier(Modifier::BOLD), - ))); - lines.push(Line::from("")); - lines.push(Line::from(Span::styled( - "Enter your DEEPSEEK_API_KEY to continue.", - Style::default().fg(palette::TEXT_PRIMARY), - ))); - lines.push(Line::from(Span::styled( - "Get your key at https://platform.deepseek.com", - Style::default().fg(palette::DEEPSEEK_SKY), - ))); - lines.push(Line::from("")); + let mut lines = vec![ + Line::from(Span::styled( + "API Key Setup", + Style::default() + .fg(palette::DEEPSEEK_SKY) + .add_modifier(Modifier::BOLD), + )), + Line::from(""), + Line::from(Span::styled( + "Enter your DEEPSEEK_API_KEY to continue.", + Style::default().fg(palette::TEXT_PRIMARY), + )), + Line::from(Span::styled( + "Get your key at https://platform.deepseek.com", + Style::default().fg(palette::DEEPSEEK_SKY), + )), + Line::from(""), + ]; let masked = mask_key(&app.api_key_input); let display = if masked.is_empty() { diff --git a/src/tui/session_picker.rs b/src/tui/session_picker.rs index 99466a00..e69228c7 100644 --- a/src/tui/session_picker.rs +++ b/src/tui/session_picker.rs @@ -82,8 +82,8 @@ impl SessionPickerView { self.filtered = self .sessions .iter() - .cloned() .filter(|session| fuzzy_match(&query, session)) + .cloned() .collect(); } @@ -140,9 +140,7 @@ impl SessionPickerView { } fn delete_selected(&mut self) -> Option { - let Some(session) = self.selected_session().cloned() else { - return None; - }; + let session = self.selected_session().cloned()?; let manager = SessionManager::default_location().ok()?; if let Err(err) = manager.delete_session(&session.id) { self.status = Some(format!("Delete failed: {err}")); @@ -337,6 +335,7 @@ impl ModalView for SessionPickerView { } } +#[allow(clippy::too_many_arguments)] fn build_list_lines( sessions: &[SessionMetadata], selected: usize,