Commit 74fe948
chore(clippy): bring cargo clippy to zero warnings and enforce -D warnings in CI (#205)
* chore(clippy): relocate cfg(test)-gated imports into test modules
EnvPlaceholder (mcp_registry.rs) and DEFAULT_MCP_SERVER_PORT (mcp_server.rs)
were imported at module level but only consumed inside #[cfg(test)] blocks.
This made them look unused to clippy's lib pass and invited a cargo-fix
regression that would strip them and break the test build. Moving the imports
into the test module where they are used eliminates the warning without
risking the test build.
Co-Authored-By: Claude <noreply@anthropic.com>
* chore(clippy): prefix unused variables with underscore
Resolves 'unused variable' warnings across 6 files by adding the _ prefix
idiom. In claude_settings.rs the mut binding was also dropped because the
variable was never mutated after the read. All sites are in test code or
Tauri command handlers where the variable captures a value kept for lifetime
purposes (app_handle.clone()) but not referenced directly.
Co-Authored-By: Claude <noreply@anthropic.com>
* chore(clippy): replace useless vec! with arrays
Sites in test code that collect JSONL lines or MCP configs into a temporary
collection only to call .join() or pass as a slice. Array literal is cheaper
(no heap allocation) and expresses intent more directly. 26 sites in
session_explorer.rs tests, 2 in config_writer.rs tests — all previously
flagged by 'clippy::useless_vec'.
Co-Authored-By: Claude <noreply@anthropic.com>
* chore(clippy): resolve dead-code warnings via targeted allows
66 dead-code warnings broken into four sub-patterns, each with its
own appropriate fix:
1. Test-helper pub(crate) fns (45 sites across 9 files): #[cfg_attr(not(test),
allow(dead_code))]. These are #[cfg(test)]-consumed helpers exposed as
pub(crate) so the test module can bypass Tauri State<> wrappers. The attr
suppresses the warning for non-test builds while preserving genuine
dead-code detection in test builds.
2. Vestigial typed-parser vendor hierarchy: 4 enums (CodexMcp, CopilotMcp,
CursorMcp, GeminiMcp) + 8 Stdio/Http variant structs. These were
scaffolded for a typed intermediate-representation parse path that was
never wired up; current code uses ParsedXxxMcp normalization directly.
Annotated with #[allow(dead_code)] + a comment noting the design intent so
they remain available for future typed-parse work.
3. Serde-deser false positives (DevcontainerConfig, ProfileItem,
SpinnerVerbConfig, 3 fields on RawRecord/RawMessage/ToolManagerServer).
Clippy's 'never constructed' lint does not see serde's
Deserialize-generated constructors. Standard #[allow(dead_code)] idiom.
4. One genuine deletion: Database::from_connection in db/schema.rs. Already
#[cfg(test)]-gated with zero callers; sibling Database::in_memory() is the
actual entry point used throughout tests.
Dead-code warning count: 66 -> 0. Total clippy warnings: 134 -> 68.
Co-Authored-By: Claude <noreply@anthropic.com>
* chore(clippy): apply mechanical autofix suggestions
Broad pass applying clippy's machine-applicable suggestions now that the
cfg(test)-gated-import and unused-variable landmines have been resolved.
Covers:
- manual Option::map rewrites (several sites in mcp_client.rs, skills.rs,
session_explorer.rs)
- assert_eq!(x, true/false) -> assert!(x) / assert!(!x)
- useless format! dropped
- redundant closures replaced with the function itself
- Iterator::last on DoubleEndedIterator -> .next_back()
- map_or simplification
- Option::map().flatten() -> and_then
- map().values() iteration cleanup
- assorted rustfmt normalization introduced by the rewrites
Additionally: replaced a tautological bool assertion in debug_logger.rs
(assert!(enabled == true || enabled == false)) with 'let _ = is_debug_enabled();'
matching the adjacent test's 'let _ = path;' pattern — the assertion was
already always-true before clippy rewrote it, and the newer nonminimal_bool
lint now flags the explicit form as an error under -D warnings.
Clippy warning count: 68 -> 33.
Co-Authored-By: Claude <noreply@anthropic.com>
* chore(clippy): accept &Path instead of &PathBuf in helper signatures
Clippy::ptr_arg prefers &Path over &PathBuf because the former is a slice
type and avoids a pointless heap indirection. 10 sites across 3 files:
- src/services/debug_logger.rs (enable_debug_logging, get_logs_dir,
get_debug_flag_path)
- src/utils/paths.rs (project_mcp_file, project_settings_file)
- src/utils/opencode_paths.rs (5 project_opencode_* helpers)
Call sites already pass &PathBuf, which auto-dereferences to &Path — no
caller changes required.
Co-Authored-By: Claude <noreply@anthropic.com>
* chore(clippy): allow type_complexity on DB-row-tuple helpers
7 command helpers use multi-field tuples (7-10 fields) for rusqlite row
extraction. These tuples ARE the domain shape — introducing type aliases
would just duplicate the tuple next to the fn without adding meaning,
and the existing file-local McpTuple aliases in services/*_config.rs
follow a different shape (writer tuples, not reader tuples).
Annotating with #[allow(clippy::type_complexity)] on the containing fn
matches the established pattern for 'this IS the data shape' cases.
Co-Authored-By: Claude <noreply@anthropic.com>
* chore(clippy): resolve long-tail warnings to reach zero
Final cleanup batch:
- opencode_paths.rs: #[cfg(test)] use std::path::Path; — Path is only needed
by the cfg(test)-gated helpers that now take &Path.
- debug_logger.rs: &PathBuf -> &Path on 3 more helpers (persist_debug_enabled,
is_debug_persisted, init_from_persisted). Missed in the first PathBuf pass.
- db/models.rs: #[cfg_attr(not(test), allow(dead_code))] on is_powerline and
is_powerline_round — test-only consumers.
- docker/client.rs: #[allow(dead_code)] on connect_with_params (private
helper used via ping_host) and ping_host (public API held for future use).
- docker/devcontainer.rs: #[allow(dead_code)] on the impl block — several
methods are defined for the DevcontainerConfig API shape but not all are
consumed today.
- commands/mod.rs: #[allow(clippy::module_inception)] on `pub mod commands`
— the nested name mirrors the Claude Code commands domain concept;
renaming would cascade through imports.
- mcp_gateway/tools.rs: #[allow(clippy::manual_async_fn)] on
impl ServerHandler — rmcp's trait uses impl Future return shape; async fn
in traits isn't usable here without widening the bound.
- commands/scanner.rs: removed tautological assert!(true) in the
compilation-smoke-test (comment documents intent instead).
- services/scanner.rs:
- #[allow(clippy::too_many_arguments)] on get_or_create_mcp (9/7)
- strip_prefix("---") rewrite in parse_frontmatter
- assert!(!fm.contains_key("empty_key")) replaces .get().is_none()
- #[allow(non_snake_case)] on test_parse_skill_file_with_allowedTools_camelCase
where the camelCase mirrors the schema field under test.
- services/mcp_registry.rs: filter_map always-Some -> map.
Clippy warning count: 17 -> 0. Tests: 2021 passing. Ready to flip CI gate.
Co-Authored-By: Claude <noreply@anthropic.com>
* ci(clippy): enforce -D warnings on lib + tests
Flips the Clippy job to block CI on warnings. Two tightenings:
- Drop 'continue-on-error: true'. The comment said 'initially' — eight
commits of cleanup later, the baseline is zero warnings, so the gate
becomes meaningful.
- Add '--lib --tests' to the clippy invocation so the ~120 warnings that
lived exclusively in the test target are covered too. Without this the
prior gate (if enforced) would have allowed test-only lint debt to
accumulate invisibly.
All other CI jobs untouched. No policy change beyond Clippy enforcement.
Co-Authored-By: Claude <noreply@anthropic.com>
* fix(clippy): address rust 1.95 warnings
---------
Co-authored-by: Scot Campbell <prefrontalsys@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>1 parent 63671e3 commit 74fe948
43 files changed
Lines changed: 252 additions & 202 deletions
File tree
- .github/workflows
- src-tauri/src
- commands
- db
- mcp_gateway
- mcp_server
- services
- docker
- utils
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | | - | |
96 | | - | |
| 95 | + | |
97 | 96 | | |
98 | 97 | | |
99 | 98 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
329 | 329 | | |
330 | 330 | | |
331 | 331 | | |
332 | | - | |
333 | | - | |
| 332 | + | |
334 | 333 | | |
335 | 334 | | |
336 | 335 | | |
337 | | - | |
338 | | - | |
| 336 | + | |
339 | 337 | | |
340 | 338 | | |
341 | 339 | | |
| |||
644 | 642 | | |
645 | 643 | | |
646 | 644 | | |
647 | | - | |
648 | | - | |
| 645 | + | |
649 | 646 | | |
650 | 647 | | |
651 | 648 | | |
652 | | - | |
653 | | - | |
| 649 | + | |
654 | 650 | | |
655 | 651 | | |
656 | 652 | | |
| |||
706 | 702 | | |
707 | 703 | | |
708 | 704 | | |
709 | | - | |
710 | | - | |
| 705 | + | |
711 | 706 | | |
712 | 707 | | |
713 | 708 | | |
714 | 709 | | |
715 | | - | |
716 | | - | |
| 710 | + | |
717 | 711 | | |
718 | 712 | | |
719 | 713 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| 73 | + | |
73 | 74 | | |
74 | 75 | | |
75 | 76 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | | - | |
| 26 | + | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
910 | 910 | | |
911 | 911 | | |
912 | 912 | | |
| 913 | + | |
913 | 914 | | |
914 | 915 | | |
915 | 916 | | |
| |||
939 | 940 | | |
940 | 941 | | |
941 | 942 | | |
| 943 | + | |
942 | 944 | | |
943 | 945 | | |
944 | 946 | | |
| |||
971 | 973 | | |
972 | 974 | | |
973 | 975 | | |
| 976 | + | |
974 | 977 | | |
975 | 978 | | |
976 | 979 | | |
| |||
1020 | 1023 | | |
1021 | 1024 | | |
1022 | 1025 | | |
| 1026 | + | |
1023 | 1027 | | |
1024 | 1028 | | |
1025 | 1029 | | |
| |||
1028 | 1032 | | |
1029 | 1033 | | |
1030 | 1034 | | |
| 1035 | + | |
1031 | 1036 | | |
1032 | 1037 | | |
1033 | 1038 | | |
| |||
1039 | 1044 | | |
1040 | 1045 | | |
1041 | 1046 | | |
| 1047 | + | |
1042 | 1048 | | |
1043 | 1049 | | |
1044 | 1050 | | |
| |||
1068 | 1074 | | |
1069 | 1075 | | |
1070 | 1076 | | |
| 1077 | + | |
1071 | 1078 | | |
1072 | 1079 | | |
1073 | 1080 | | |
| |||
1083 | 1090 | | |
1084 | 1091 | | |
1085 | 1092 | | |
| 1093 | + | |
1086 | 1094 | | |
1087 | 1095 | | |
1088 | 1096 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
| 238 | + | |
238 | 239 | | |
239 | 240 | | |
240 | 241 | | |
| |||
319 | 320 | | |
320 | 321 | | |
321 | 322 | | |
| 323 | + | |
322 | 324 | | |
323 | 325 | | |
324 | 326 | | |
325 | 327 | | |
| 328 | + | |
326 | 329 | | |
327 | 330 | | |
328 | 331 | | |
329 | 332 | | |
| 333 | + | |
330 | 334 | | |
331 | 335 | | |
332 | 336 | | |
333 | 337 | | |
| 338 | + | |
334 | 339 | | |
335 | 340 | | |
336 | 341 | | |
| |||
339 | 344 | | |
340 | 345 | | |
341 | 346 | | |
| 347 | + | |
342 | 348 | | |
343 | 349 | | |
344 | 350 | | |
345 | 351 | | |
| 352 | + | |
346 | 353 | | |
347 | 354 | | |
348 | 355 | | |
| |||
708 | 715 | | |
709 | 716 | | |
710 | 717 | | |
711 | | - | |
| 718 | + | |
712 | 719 | | |
713 | 720 | | |
714 | 721 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
98 | | - | |
| 97 | + | |
99 | 98 | | |
100 | 99 | | |
101 | 100 | | |
102 | | - | |
103 | | - | |
| 101 | + | |
104 | 102 | | |
105 | 103 | | |
106 | 104 | | |
107 | | - | |
108 | | - | |
| 105 | + | |
109 | 106 | | |
110 | 107 | | |
111 | 108 | | |
| |||
166 | 163 | | |
167 | 164 | | |
168 | 165 | | |
| 166 | + | |
169 | 167 | | |
170 | 168 | | |
171 | 169 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
8 | | - | |
| 6 | + | |
9 | 7 | | |
10 | 8 | | |
11 | 9 | | |
| |||
148 | 146 | | |
149 | 147 | | |
150 | 148 | | |
| 149 | + | |
151 | 150 | | |
152 | 151 | | |
153 | 152 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
84 | 85 | | |
85 | 86 | | |
86 | 87 | | |
| 88 | + | |
87 | 89 | | |
88 | 90 | | |
89 | 91 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
163 | 164 | | |
164 | 165 | | |
165 | 166 | | |
| 167 | + | |
| 168 | + | |
166 | 169 | | |
167 | 170 | | |
168 | 171 | | |
| |||
217 | 220 | | |
218 | 221 | | |
219 | 222 | | |
| 223 | + | |
220 | 224 | | |
221 | 225 | | |
222 | 226 | | |
| |||
0 commit comments