fix(clippy): clear -D warnings across changed code (#2599)
Resolves the workspace clippy warnings so the release gate (`cargo clippy --workspace --all-targets -- -D warnings`) is clean: - chat.rs: elide needless lifetime on `next_arcee_waf_trigger` (returned strs are `'static`). - llm_client/mod.rs: use `enumerate()` instead of a manual loop counter in `truncate_for_error` (explicit_counter_loop). - ui.rs: `#[allow(clippy::too_many_arguments)]` on `apply_model_picker_choice` with rationale (8 distinct handles/states; a struct would only obscure it). - file_picker.rs: gate the test-only `WALK_DEPTH` const and `new_with_relevance` convenience ctor behind `#[cfg(test)]` (the #2488 change moved production callers to `new_with_relevance_and_depth`). The 6 schema_migration registry structs the issue noted are no longer flagged (their trait impls keep them live). Also normalizes rustfmt formatting on the touched lines. https://claude.ai/code/session_01MQrnh6wHfrEYN5BBdMarC1
This commit is contained in:
@@ -618,10 +618,7 @@ fn arcee_waf_safe_text_parts(content: &str) -> Option<Vec<Value>> {
|
||||
split_any.then_some(parts)
|
||||
}
|
||||
|
||||
fn next_arcee_waf_trigger<'a>(
|
||||
content: &'a str,
|
||||
cursor: usize,
|
||||
) -> Option<(usize, &'a str, &'a str, &'a str)> {
|
||||
fn next_arcee_waf_trigger(content: &str, cursor: usize) -> Option<(usize, &str, &str, &str)> {
|
||||
ARCEE_WAF_TEXT_SPLIT_TRIGGERS
|
||||
.iter()
|
||||
.filter_map(|(trigger, left, right)| {
|
||||
|
||||
@@ -5069,7 +5069,8 @@ mod tests {
|
||||
fn warns_when_allow_shell_nested_under_general_section() {
|
||||
// #2589: the reporter's config nested top-level keys under sections that
|
||||
// do not exist, so they were silently dropped and shell tools vanished.
|
||||
let raw = "[general]\nallow_shell = true\n\n[sandbox]\nsandbox_mode = \"danger-full-access\"\n";
|
||||
let raw =
|
||||
"[general]\nallow_shell = true\n\n[sandbox]\nsandbox_mode = \"danger-full-access\"\n";
|
||||
let warning =
|
||||
warn_on_misplaced_top_level_keys(raw).expect("misplaced keys should produce a warning");
|
||||
assert!(warning.contains("general.allow_shell"));
|
||||
|
||||
@@ -456,14 +456,12 @@ fn collapse_whitespace(input: &str) -> String {
|
||||
|
||||
fn truncate_for_error(input: &str, max_chars: usize) -> String {
|
||||
let mut out = String::with_capacity(input.len().min(max_chars + 32));
|
||||
let mut count = 0usize;
|
||||
for ch in input.chars() {
|
||||
for (count, ch) in input.chars().enumerate() {
|
||||
if count >= max_chars {
|
||||
out.push_str("...");
|
||||
return out;
|
||||
}
|
||||
out.push(ch);
|
||||
count += 1;
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
@@ -32,9 +32,11 @@ use crate::workspace_discovery::{DISCOVERY_ALWAYS_DIRS, path_is_excluded_from_di
|
||||
/// equivalent overlay.
|
||||
const MAX_CANDIDATES: usize = 20_000;
|
||||
|
||||
/// Default walk depth for the initial scan when no explicit depth is supplied.
|
||||
/// Mirrors the `Workspace` fuzzy index default (`DEFAULT_COMPLETIONS_WALK_DEPTH`).
|
||||
/// `mention_walk_depth = 0` overrides this with an unlimited walk.
|
||||
/// Default walk depth used by the picker's own tests. Production callers pass
|
||||
/// the configured `mention_walk_depth` (default 10, `0` = unlimited) through
|
||||
/// [`FilePickerView::new_with_relevance_and_depth`], mirroring the `Workspace`
|
||||
/// fuzzy index default (`DEFAULT_COMPLETIONS_WALK_DEPTH`).
|
||||
#[cfg(test)]
|
||||
const WALK_DEPTH: usize = 10;
|
||||
|
||||
/// Visible candidate rows in the overlay.
|
||||
@@ -125,7 +127,10 @@ pub struct FilePickerView {
|
||||
|
||||
impl FilePickerView {
|
||||
/// Build a picker with working-set relevance hints, using the default
|
||||
/// walk depth ([`WALK_DEPTH`]).
|
||||
/// walk depth ([`WALK_DEPTH`]). Test-only convenience; production code uses
|
||||
/// [`FilePickerView::new_with_relevance_and_depth`] with the configured
|
||||
/// `mention_walk_depth`.
|
||||
#[cfg(test)]
|
||||
pub fn new_with_relevance(workspace_root: &Path, relevance: FilePickerRelevance) -> Self {
|
||||
Self::new_with_relevance_and_depth(workspace_root, relevance, WALK_DEPTH)
|
||||
}
|
||||
|
||||
@@ -4985,6 +4985,10 @@ async fn drain_web_config_events(
|
||||
/// `~/.deepseek/settings.toml` so it survives a restart, push the change to
|
||||
/// the running engine via `Op::SetModel`/`Op::SetCompaction`, and surface
|
||||
/// a one-line status describing what changed.
|
||||
// The model/effort transition needs both the previous and next model+effort
|
||||
// plus the engine, app, and config handles; bundling them into a struct here
|
||||
// would only obscure a straightforward orchestration step.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
async fn apply_model_picker_choice(
|
||||
app: &mut App,
|
||||
engine_handle: &mut EngineHandle,
|
||||
|
||||
Reference in New Issue
Block a user