Skip to content

Commit e213fa5

Browse files
Codestzxclaude
andcommitted
fix(ci): clippy errors, remove MSRV job, fix security audit lockfile
- cast_signed(): restore after cast_possible_wrap clippy errors; stabilized in 1.87 - commands/server.rs: add missing semicolon in warn! closure - daemon/server.rs: extract postprocess_symbols() helper, handle_find_symbol now <100 lines - ci.yml: remove MSRV job, add cargo generate-lockfile before audit (Cargo.lock is gitignored) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 724a1d3 commit e213fa5

3 files changed

Lines changed: 42 additions & 49 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -42,31 +42,15 @@ jobs:
4242
- name: Run tests
4343
run: cargo test
4444

45-
msrv:
46-
name: Minimum Supported Rust Version (1.85)
47-
runs-on: ubuntu-22.04
48-
steps:
49-
- uses: actions/checkout@v6
50-
51-
- uses: dtolnay/rust-toolchain@master
52-
with:
53-
toolchain: "1.85"
54-
55-
- uses: actions/cache@v5
56-
with:
57-
path: |
58-
~/.cargo/registry
59-
~/.cargo/git
60-
target/
61-
key: ${{ runner.os }}-cargo-msrv-${{ hashFiles('**/Cargo.toml') }}
62-
63-
- run: cargo build
64-
6545
security-audit:
6646
name: Security Audit
6747
runs-on: ubuntu-22.04
6848
steps:
6949
- uses: actions/checkout@v6
50+
51+
- name: Generate lockfile
52+
run: cargo generate-lockfile
53+
7054
- uses: rustsec/audit-check@v2
7155
with:
7256
token: ${{ secrets.GITHUB_TOKEN }}

src/commands/server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ pub async fn handle_install(
141141
let managed = managed_dir.join(preferred.binary_name);
142142
if managed.exists() {
143143
std::fs::remove_file(&managed).unwrap_or_else(|e| {
144-
tracing::warn!("could not remove {}: {e}", managed.display())
144+
tracing::warn!("could not remove {}: {e}", managed.display());
145145
});
146146
}
147147
}

src/daemon/server.rs

Lines changed: 37 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -486,17 +486,13 @@ async fn handle_find_symbol(
486486
"find_symbol cache hit for '{name}' ({} results)",
487487
results.len()
488488
);
489-
let filtered = filter_by_path(results, path_filter);
490-
let filtered = if src_only {
491-
filter_src_only(filtered, &state.project_root)
492-
} else {
493-
filtered
494-
};
495-
let filtered = if include_body {
496-
populate_bodies(filtered, &state.project_root)
497-
} else {
498-
filtered
499-
};
489+
let filtered = postprocess_symbols(
490+
results,
491+
path_filter,
492+
src_only,
493+
include_body,
494+
&state.project_root,
495+
);
500496
return Response::ok(serde_json::to_value(filtered).unwrap_or_default());
501497
}
502498
}
@@ -560,12 +556,8 @@ async fn handle_find_symbol(
560556
.await
561557
.unwrap_or_default();
562558

563-
let filtered = filter_by_path(fallback, path_filter);
564-
let filtered = if src_only {
565-
filter_src_only(filtered, &state.project_root)
566-
} else {
567-
filtered
568-
};
559+
let filtered =
560+
postprocess_symbols(fallback, path_filter, src_only, false, &state.project_root);
569561
if filtered.is_empty() {
570562
return Response::ok(json!([]));
571563
}
@@ -576,17 +568,13 @@ async fn handle_find_symbol(
576568
};
577569
Response::ok(serde_json::to_value(filtered).unwrap_or_default())
578570
} else {
579-
let filtered = filter_by_path(merged, path_filter);
580-
let filtered = if src_only {
581-
filter_src_only(filtered, &state.project_root)
582-
} else {
583-
filtered
584-
};
585-
let filtered = if include_body {
586-
populate_bodies(filtered, &state.project_root)
587-
} else {
588-
filtered
589-
};
571+
let filtered = postprocess_symbols(
572+
merged,
573+
path_filter,
574+
src_only,
575+
include_body,
576+
&state.project_root,
577+
);
590578
Response::ok(serde_json::to_value(filtered).unwrap_or_default())
591579
}
592580
}
@@ -705,6 +693,27 @@ async fn handle_find_refs(name: &str, with_symbol: bool, state: &DaemonState) ->
705693
}
706694
}
707695

696+
/// Apply path filter, src-only filter, and optional body population in one pass.
697+
fn postprocess_symbols(
698+
symbols: Vec<find::SymbolMatch>,
699+
path_filter: Option<&str>,
700+
src_only: bool,
701+
include_body: bool,
702+
project_root: &Path,
703+
) -> Vec<find::SymbolMatch> {
704+
let filtered = filter_by_path(symbols, path_filter);
705+
let filtered = if src_only {
706+
filter_src_only(filtered, project_root)
707+
} else {
708+
filtered
709+
};
710+
if include_body {
711+
populate_bodies(filtered, project_root)
712+
} else {
713+
filtered
714+
}
715+
}
716+
708717
/// Filter a `Vec<SymbolMatch>` to entries whose path contains `substr`.
709718
/// Returns the original vec unchanged when `substr` is `None`.
710719
fn filter_by_path(symbols: Vec<find::SymbolMatch>, substr: Option<&str>) -> Vec<find::SymbolMatch> {

0 commit comments

Comments
 (0)