处理#[allow(dead_code)]代码

This commit is contained in:
xintaofei
2026-03-07 18:04:36 +08:00
parent b1ea16fae0
commit dacec69481
10 changed files with 10 additions and 29 deletions

View File

@@ -115,6 +115,7 @@ async fn build_agent(
app_handle: &tauri::AppHandle,
) -> Result<AcpAgent, AcpError> {
let meta = registry::get_agent_meta(agent_type);
debug_assert_eq!(meta.agent_type, agent_type);
match meta.distribution {
AgentDistribution::Npx {

View File

@@ -10,14 +10,8 @@ pub enum AcpError {
Protocol(String),
#[error("agent process exited unexpectedly")]
ProcessExited,
#[allow(dead_code)]
#[error("conversation error: {0}")]
Conversation(String),
#[error("binary download failed: {0}")]
DownloadFailed(String),
#[allow(dead_code)]
#[error("agent not found: {0}")]
AgentNotFound(String),
#[error("platform not supported: {0}")]
PlatformNotSupported(String),
}

View File

@@ -16,11 +16,8 @@ static UVX_ENV_CACHE: Mutex<Option<Vec<CheckItem>>> = Mutex::new(None);
#[derive(Debug, Clone, Serialize)]
#[serde(rename_all = "snake_case")]
#[allow(dead_code)]
pub enum FixActionKind {
OpenUrl,
RedownloadBinary,
RetryConnection,
}
#[derive(Debug, Clone, Serialize)]
@@ -57,6 +54,7 @@ pub struct PreflightResult {
pub async fn run_preflight(agent_type: AgentType) -> PreflightResult {
let meta = registry::get_agent_meta(agent_type);
debug_assert_eq!(meta.agent_type, agent_type);
let checks = match &meta.distribution {
AgentDistribution::Npx { node_required, .. } => check_npx_environment(*node_required).await,
AgentDistribution::Uvx { .. } => check_uvx_environment().await,

View File

@@ -33,7 +33,6 @@ pub struct PlatformBinary {
#[derive(Debug, Clone)]
pub struct AcpAgentMeta {
#[allow(dead_code)]
pub agent_type: AgentType,
pub name: &'static str,
pub description: &'static str,
@@ -127,7 +126,6 @@ pub fn registry_id_for(agent_type: AgentType) -> &'static str {
}
}
#[allow(dead_code)]
pub fn from_registry_id(id: &str) -> Option<AgentType> {
match id {
"auggie" => Some(AgentType::Auggie),
@@ -155,6 +153,7 @@ pub fn from_registry_id(id: &str) -> Option<AgentType> {
}
pub fn get_agent_meta(agent_type: AgentType) -> AcpAgentMeta {
debug_assert_eq!(from_registry_id(registry_id_for(agent_type)), Some(agent_type));
match agent_type {
AgentType::Auggie => AcpAgentMeta {
agent_type,