Cargo warnings and tests: dead code in mcp.rs + 3 clippy lints (fails make lint -D warnings) #45

Closed
opened 2026-04-22 12:44:41 +00:00 by rawdaGastan · 0 comments
Member

Summary

Scanned the workspace on branch development with cargo check, cargo build, cargo clippy --all-targets, and cargo test --workspace. Tests pass (16/16), but the build emits 10 warnings, and make lint / make test-all currently fail because they run clippy with -D warnings.

All warnings live in crates/hero_router/.

Findings

1. Dead code — 7 unused functions in crates/hero_router/src/server/mcp.rs

These surface on every cargo check / build / test:

Line Function
461 named_to_positional
519 coerce_value
538 coerce_to_array
583 coerce_to_bool
597 coerce_to_integer
611 coerce_to_number
625 coerce_to_string

These look like they were written to translate MCP named arguments into positional JSON-RPC params with schema-driven type coercion, but nothing calls them. Either wire them into the MCP dispatch path or delete them.

2. Clippy-only warnings (3)

Only surface under cargo clippy --all-targets:

  • crates/hero_router/src/python_codegen.rs:539collapsible_if: the if let Some(components) = ... { if !components.is_empty() { ... } } block can be collapsed with a let … else or && guard.
  • crates/hero_router/src/server/terminal.rs:64unnecessary_cast (i64i64): existing.id.unwrap_or(0) as i64 should drop the as i64.
  • crates/hero_router/src/server/terminal.rs:181unnecessary_cast (i64i64): job.id.ok_or_else(...)? as i64 should drop the as i64.

Impact

  • make lint (cargo clippy --workspace --all-targets -- -D warnings) currently fails.
  • make test-all fails at the lint step, so the CI recipe is currently red against development.
  • Regular cargo build / cargo test succeed but produce noisy output.

Proposed fix

  1. Delete the 7 unused named_to_positional / coerce_* helpers in mcp.rs, unless there's a pending MCP change that needs them — in which case wire them in.
  2. Collapse the nested if in python_codegen.rs:539.
  3. Remove the two as i64 casts in server/terminal.rs.
  4. After that, make test-all should pass end-to-end.

Reproduction

cd /path/to/hero_router
source scripts/build_lib.sh && cargo_env
cargo clippy --workspace --all-targets   # 10 warnings
cargo test --workspace                     # 16 pass, 7 warnings
make lint                                  # fails (-D warnings)

Environment: branch development, rustc pinned via rust-toolchain / workspace config.

## Summary Scanned the workspace on branch `development` with `cargo check`, `cargo build`, `cargo clippy --all-targets`, and `cargo test --workspace`. Tests pass (16/16), but the build emits **10 warnings**, and `make lint` / `make test-all` currently fail because they run clippy with `-D warnings`. All warnings live in `crates/hero_router/`. ## Findings ### 1. Dead code — 7 unused functions in `crates/hero_router/src/server/mcp.rs` These surface on every `cargo check` / `build` / `test`: | Line | Function | |------|----------| | 461 | `named_to_positional` | | 519 | `coerce_value` | | 538 | `coerce_to_array` | | 583 | `coerce_to_bool` | | 597 | `coerce_to_integer` | | 611 | `coerce_to_number` | | 625 | `coerce_to_string` | These look like they were written to translate MCP named arguments into positional JSON-RPC params with schema-driven type coercion, but nothing calls them. Either wire them into the MCP dispatch path or delete them. ### 2. Clippy-only warnings (3) Only surface under `cargo clippy --all-targets`: - `crates/hero_router/src/python_codegen.rs:539` — `collapsible_if`: the `if let Some(components) = ... { if !components.is_empty() { ... } }` block can be collapsed with a `let … else` or `&&` guard. - `crates/hero_router/src/server/terminal.rs:64` — `unnecessary_cast` (`i64` → `i64`): `existing.id.unwrap_or(0) as i64` should drop the `as i64`. - `crates/hero_router/src/server/terminal.rs:181` — `unnecessary_cast` (`i64` → `i64`): `job.id.ok_or_else(...)? as i64` should drop the `as i64`. ## Impact - `make lint` (`cargo clippy --workspace --all-targets -- -D warnings`) currently fails. - `make test-all` fails at the lint step, so the CI recipe is currently red against `development`. - Regular `cargo build` / `cargo test` succeed but produce noisy output. ## Proposed fix 1. Delete the 7 unused `named_to_positional` / `coerce_*` helpers in `mcp.rs`, unless there's a pending MCP change that needs them — in which case wire them in. 2. Collapse the nested `if` in `python_codegen.rs:539`. 3. Remove the two `as i64` casts in `server/terminal.rs`. 4. After that, `make test-all` should pass end-to-end. ## Reproduction ```bash cd /path/to/hero_router source scripts/build_lib.sh && cargo_env cargo clippy --workspace --all-targets # 10 warnings cargo test --workspace # 16 pass, 7 warnings make lint # fails (-D warnings) ``` Environment: branch `development`, rustc pinned via `rust-toolchain` / workspace config.
rawdaGastan removed their assignment 2026-04-22 12:45:05 +00:00
rawdaGastan added this to the ACTIVE project 2026-04-22 12:45:09 +00:00
rawdaGastan changed title from Cargo warnings: dead code in mcp.rs + 3 clippy lints (fails make lint -D warnings) to Cargo warnings and tests: dead code in mcp.rs + 3 clippy lints (fails make lint -D warnings) 2026-04-22 12:45:45 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_router#45
No description provided.