fix: resolve clippy warnings for Rust 1.92
- 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)
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -7,23 +7,24 @@ use crate::palette;
|
||||
use crate::tui::app::App;
|
||||
|
||||
pub fn lines(app: &App) -> Vec<Line<'static>> {
|
||||
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() {
|
||||
|
||||
@@ -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<ViewEvent> {
|
||||
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,
|
||||
|
||||
Reference in New Issue
Block a user