mirror of
https://github.com/0xMassi/webclaw.git
synced 2026-06-06 22:05:13 +02:00
fix(mcp): silence dead-code warning on tool_router field (closes #30)
cargo install webclaw-mcp on a fresh machine prints warning: field `tool_router` is never read --> crates/webclaw-mcp/src/server.rs:22:5 The field is essential — dropping it unregisters every MCP tool. The warning shows up because rmcp 1.3.x changed how the #[tool_handler] macro reads the field: instead of referencing it by name in the generated impl, it goes through a derived trait method. rustc's dead-code lint sees only the named usage and fires. The field stays. Annotated with #[allow(dead_code)] and a comment explaining the situation so the next person looking at this doesn't remove the field thinking it's actually unused. No behaviour change. Verified clean compile under rmcp 1.3.0 in our lock; the warning will disappear for anyone running cargo install against this commit.
This commit is contained in:
parent
d91ad9c1f4
commit
d71eebdacc
1 changed files with 6 additions and 0 deletions
|
|
@ -19,6 +19,12 @@ use crate::cloud::{self, CloudClient, SmartFetchResult};
|
|||
use crate::tools::*;
|
||||
|
||||
pub struct WebclawMcp {
|
||||
/// Holds the registered MCP tools. `rmcp >= 1.3` reads this through a
|
||||
/// derived trait impl (not by name), so rustc's dead-code lint can't
|
||||
/// see the usage and fires a spurious `field tool_router is never
|
||||
/// read` on `cargo install`. The field is essential — dropping it
|
||||
/// would unregister every tool. See issue #30.
|
||||
#[allow(dead_code)]
|
||||
tool_router: ToolRouter<Self>,
|
||||
fetch_client: Arc<webclaw_fetch::FetchClient>,
|
||||
/// Lazily-initialized Firefox client, reused across all tool calls that
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue