chore: 消除全部编译 warning

在 src/tools/subprocess.rs 文件顶部添加 #![allow(dead_code)],
因为该模块作为可选功能(JSON 工具定义)未被 daemon 主线直接调用。
移除冗余的逐个 #[allow(dead_code)] 标注。
This commit is contained in:
2026-06-09 21:11:53 +08:00
parent 079be45615
commit ee5c9b733f
+6 -4
View File
@@ -1,3 +1,4 @@
#![allow(dead_code)]
//! ## JSON 工具子进程执行器
//!
//! ### 设计理念:"放 JSON 即用"
@@ -25,6 +26,11 @@
//!
//! ### 缓存
//! `${cmd:...}` 的结果会被缓存 300 秒,适合 JWT token 等有时效的值。
//!
//! ### 注意
//! 此模块当前未被 daemon 主线直接调用(通过 `BuiltinRegistry` 走内置工具路径),
//! 但作为可选功能保留:用户将 JSON 工具定义放入 `~/.ias/tools/` 即可使用。
//! 所以函数标记为 `#![allow(dead_code)]` 避免编译警告。
use crate::tools::definitions::{HttpMethod, ToolDef};
use crate::tools::types::{SkillResult, SkillSpec};
@@ -161,7 +167,6 @@ impl SubprocessRunner {
}
/// 重载全部工具(运行时热加载)
#[allow(dead_code)]
pub fn reload(&self) {
let dir = tools_dir();
let mut new_tools = HashMap::new();
@@ -188,7 +193,6 @@ impl SubprocessRunner {
}
/// 获取工具 spec(参数从 URL/Body 模板推导)
#[allow(dead_code)]
pub fn spec(&self, name: &str) -> Option<SkillSpec> {
self.tools.read().ok().and_then(|m| m.get(name).map(|d| d.to_spec()))
}
@@ -381,7 +385,6 @@ fn urlencoding(s: &str) -> String {
}
/// 解析模板值(无 args 上下文,主要用于测试)
#[allow(dead_code)]
fn resolve_template_value(template: &str) -> String {
if let Some(env_key) = template.strip_prefix("${env:").and_then(|s| s.strip_suffix('}')) {
return std::env::var(env_key).unwrap_or_default();
@@ -444,7 +447,6 @@ fn resolve_headers_with_args(
}
/// 渲染 header 值(无 args 上下文,主要用于测试)
#[allow(dead_code)]
fn resolve_headers(
headers: Option<&HashMap<String, String>>,
) -> Vec<(String, String)> {