Skip to content

Commit 9d0ce35

Browse files
authored
Merge pull request gi-dellav#119 from xavierforge/chore/fix-clippy-warnings
chore(lint): resolve clippy warnings across default and feature builds
2 parents 5908dee + 0d06aa9 commit 9d0ce35

13 files changed

Lines changed: 91 additions & 96 deletions

File tree

src/agent/runner.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ fn format_tool_args_summary(args_json: &serde_json::Value) -> String {
463463
} else {
464464
s
465465
};
466-
return format!("{}", truncated);
466+
return truncated.to_string();
467467
}
468468
}
469469
String::new()

src/config/load.rs

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -129,29 +129,28 @@ pub fn save_quick_model(
129129
}
130130

131131
fn rich_default_config() -> Config {
132-
let mut cfg = Config::default();
133-
cfg.quick_models = Some(default_quick_models());
134-
cfg.provider = Some(CompactString::new("openrouter"));
135-
cfg.model = Some(CompactString::new("deepseek/deepseek-v4-pro"));
136-
cfg.max_tokens = Some(16384);
137-
cfg.compact_enabled = Some(true);
138-
cfg.max_text_file_size = Some(1_048_576);
139-
cfg.edit_system = Some(EditSystem::Similarity);
140-
cfg.default_permission_mode = Some("standard".to_string());
141-
cfg.default_prompt = Some(CompactString::new("code"));
142-
cfg.show_tool_details = None;
143-
#[cfg(feature = "subagents")]
144-
{
145-
cfg.subagent_max_read_lines = Some(2000);
146-
cfg.subagent_max_grep_results = Some(200);
147-
cfg.subagent_max_find_results = Some(200);
148-
}
149-
cfg.chain = Some(crate::config::types::ChainConfig::default());
150-
#[cfg(feature = "advisor")]
151-
{
152-
cfg.advisor = Some(crate::config::types::AdvisorConfig::default());
132+
Config {
133+
quick_models: Some(default_quick_models()),
134+
provider: Some(CompactString::new("openrouter")),
135+
model: Some(CompactString::new("deepseek/deepseek-v4-pro")),
136+
max_tokens: Some(16384),
137+
compact_enabled: Some(true),
138+
max_text_file_size: Some(1_048_576),
139+
edit_system: Some(EditSystem::Similarity),
140+
default_permission_mode: Some("standard".to_string()),
141+
default_prompt: Some(CompactString::new("code")),
142+
show_tool_details: None,
143+
chain: Some(crate::config::types::ChainConfig::default()),
144+
#[cfg(feature = "subagents")]
145+
subagent_max_read_lines: Some(2000),
146+
#[cfg(feature = "subagents")]
147+
subagent_max_grep_results: Some(200),
148+
#[cfg(feature = "subagents")]
149+
subagent_max_find_results: Some(200),
150+
#[cfg(feature = "advisor")]
151+
advisor: Some(crate::config::types::AdvisorConfig::default()),
152+
..Default::default()
153153
}
154-
cfg
155154
}
156155

157156
pub fn load() -> (Config, bool) {

src/config/mod.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,10 @@ impl Config {
213213
return rt;
214214
}
215215
for qmc in qm.values() {
216-
if qmc.model.as_str() == model_id {
217-
if let Some(rt) = qmc.reserve_tokens {
218-
return rt;
219-
}
216+
if qmc.model.as_str() == model_id
217+
&& let Some(rt) = qmc.reserve_tokens
218+
{
219+
return rt;
220220
}
221221
}
222222
8_192
@@ -238,10 +238,10 @@ impl Config {
238238
return Some(temp.clamp(0.0, 2.0));
239239
}
240240
for qmc in qm.values() {
241-
if qmc.model.as_str() == model_id {
242-
if let Some(temp) = qmc.temperature {
243-
return Some(temp.clamp(0.0, 2.0));
244-
}
241+
if qmc.model.as_str() == model_id
242+
&& let Some(temp) = qmc.temperature
243+
{
244+
return Some(temp.clamp(0.0, 2.0));
245245
}
246246
}
247247
self.temperature.map(|t| t.clamp(0.0, 2.0))

src/extras/memory/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ impl Mem {
161161
}
162162
}
163163

164-
fn truncate_to_bytes<'a>(s: &'a str, max: usize) -> &'a str {
164+
fn truncate_to_bytes(s: &str, max: usize) -> &str {
165165
if s.len() <= max {
166166
return s;
167167
}

src/extras/subagents/builder.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use crate::provider::{AnyAgent, AnyModel, OpenAiAgent, OpenAiModel};
44
use rig::agent::{Agent, AgentBuilder};
55
use rig::completion::CompletionModel;
66

7+
#[allow(clippy::too_many_arguments)]
78
fn build_explore_agent_inner<M: CompletionModel + 'static>(
89
model: M,
910
max_turns: usize,

src/main.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -480,12 +480,12 @@ async fn main() -> anyhow::Result<()> {
480480
content.clone()
481481
};
482482

483-
#[allow(unused_mut)]
484-
let mut caps: Vec<&str> = Vec::new();
485-
#[cfg(feature = "memory")]
486-
caps.push("- **Memory**: persistent memory across sessions (memory_read, memory_write, memory_search)");
487-
#[cfg(feature = "subagents")]
488-
caps.push("- **Subagents**: delegate specific multi-step investigations to parallel subagents via the `task` tool");
483+
let caps: &[&str] = &[
484+
#[cfg(feature = "memory")]
485+
"- **Memory**: persistent memory across sessions (memory_read, memory_write, memory_search)",
486+
#[cfg(feature = "subagents")]
487+
"- **Subagents**: delegate specific multi-step investigations to parallel subagents via the `task` tool",
488+
];
489489

490490
if !caps.is_empty() {
491491
prompt_text.push_str("\n\n## Available Capabilities\n\n");
@@ -508,12 +508,12 @@ async fn main() -> anyhow::Result<()> {
508508
content.clone()
509509
};
510510

511-
#[allow(unused_mut)]
512-
let mut caps: Vec<&str> = Vec::new();
513-
#[cfg(feature = "memory")]
514-
caps.push("- **Memory**: persistent memory across sessions (memory_read, memory_write, memory_search)");
515-
#[cfg(feature = "subagents")]
516-
caps.push("- **Subagents**: delegate specific multi-step investigations to parallel subagents via the `task` tool");
511+
let caps: &[&str] = &[
512+
#[cfg(feature = "memory")]
513+
"- **Memory**: persistent memory across sessions (memory_read, memory_write, memory_search)",
514+
#[cfg(feature = "subagents")]
515+
"- **Subagents**: delegate specific multi-step investigations to parallel subagents via the `task` tool",
516+
];
517517

518518
if !caps.is_empty() {
519519
prompt_text.push_str("\n\n## Available Capabilities\n\n");

src/permission/checker.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,7 @@ impl PermissionChecker {
248248
}
249249
}),
250250
SecurityMode::PlanWrite => base.unwrap_or_else(|| {
251-
if self.is_read_tool(tool) {
252-
Action::Allow
253-
} else if matches!(tool, "write" | "edit") && is_plan_file(abs_path) {
251+
if self.is_read_tool(tool) || (matches!(tool, "write" | "edit") && is_plan_file(abs_path)) {
254252
Action::Allow
255253
} else {
256254
Action::Deny

src/provider.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -882,6 +882,7 @@ pub async fn build_agent(
882882
}
883883

884884
/// Builds the isolated, tool-less `/btw` agent for the active provider.
885+
#[allow(clippy::too_many_arguments)]
885886
pub fn build_btw_agent(
886887
model: AnyModel,
887888
cli: &Cli,

src/session/storage.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ pub fn find_recent_sessions(limit: usize) -> anyhow::Result<Vec<Session>> {
8888
.collect();
8989

9090
// Sort newest first
91-
entries.sort_by(|a, b| b.0.cmp(&a.0));
91+
entries.sort_by_key(|b| std::cmp::Reverse(b.0));
9292

9393
let mut sessions: Vec<Session> = Vec::new();
9494
for (_, path) in entries.iter().take(limit) {

src/ui/mod.rs

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ pub(crate) fn classify_submission(is_running: bool, text: &str) -> SubmitAction
232232
}
233233

234234
#[cfg(feature = "git-worktree")]
235+
#[allow(clippy::too_many_arguments)]
235236
async fn spawn_merge_agent(
236237
branch: &str,
237238
target: &str,
@@ -1307,10 +1308,10 @@ pub async fn run_interactive(
13071308
"chain declined — won't ask again this session",
13081309
C_AGENT,
13091310
)?;
1310-
if let Some(ref name) = context.current_prompt_name {
1311-
if !context.chain_declined.contains(name) {
1312-
context.chain_declined.push(name.clone());
1313-
}
1311+
if let Some(ref name) = context.current_prompt_name
1312+
&& !context.chain_declined.contains(name)
1313+
{
1314+
context.chain_declined.push(name.clone());
13141315
}
13151316
refresh_display(&mut renderer, &mut input, session, is_running, loop_label.as_deref(), context.current_prompt_name.as_deref(), perm_mode().as_deref(), chain_label_msg.as_deref(), btw_total_cost, btw_total_in, btw_total_out)?;
13161317
continue;
@@ -1319,7 +1320,7 @@ pub async fn run_interactive(
13191320
renderer.chain_but_mode = true;
13201321
renderer.chain_prompt = None;
13211322
input.clear_buffer();
1322-
chain_label_msg = chain_pending.map(|p| p.chain_label().to_string().into());
1323+
chain_label_msg = chain_pending.map(|p| p.chain_label().to_string());
13231324
refresh_display(&mut renderer, &mut input, session, is_running, loop_label.as_deref(), context.current_prompt_name.as_deref(), perm_mode().as_deref(), chain_label_msg.as_deref(), btw_total_cost, btw_total_in, btw_total_out)?;
13241325
continue;
13251326
}
@@ -2101,30 +2102,30 @@ pub async fn run_interactive(
21012102
}
21022103

21032104
#[cfg(feature = "advisor")]
2104-
if let Some(ref mut rx) = handoff_rx {
2105-
if let Ok(handoff_req) = rx.try_recv() {
2106-
handle_human_handoff(
2107-
handoff_req,
2108-
&mut renderer,
2109-
&mut user_rx,
2110-
&mut agent_line_started,
2111-
&mut was_reasoning,
2112-
)
2113-
.await?;
2114-
refresh_display(
2115-
&mut renderer,
2116-
&mut input,
2117-
session,
2118-
is_running,
2119-
loop_label.as_deref(),
2120-
context.current_prompt_name.as_deref(),
2121-
perm_mode().as_deref(),
2122-
chain_label_msg.as_deref(),
2123-
btw_total_cost,
2124-
btw_total_in,
2125-
btw_total_out,
2126-
)?;
2127-
}
2105+
if let Some(ref mut rx) = handoff_rx
2106+
&& let Ok(handoff_req) = rx.try_recv()
2107+
{
2108+
handle_human_handoff(
2109+
handoff_req,
2110+
&mut renderer,
2111+
&mut user_rx,
2112+
&mut agent_line_started,
2113+
&mut was_reasoning,
2114+
)
2115+
.await?;
2116+
refresh_display(
2117+
&mut renderer,
2118+
&mut input,
2119+
session,
2120+
is_running,
2121+
loop_label.as_deref(),
2122+
context.current_prompt_name.as_deref(),
2123+
perm_mode().as_deref(),
2124+
chain_label_msg.as_deref(),
2125+
btw_total_cost,
2126+
btw_total_in,
2127+
btw_total_out,
2128+
)?;
21282129
}
21292130
}
21302131

0 commit comments

Comments
 (0)