处理#[allow(dead_code)]代码
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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),
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -2,7 +2,6 @@ use serde::Serialize;
|
||||
|
||||
use crate::db::error::DbError;
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Debug, Clone, Copy, Serialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum AppErrorCode {
|
||||
@@ -98,7 +97,6 @@ impl AppCommandError {
|
||||
Self::new(AppErrorCode::TaskExecutionFailed, message)
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn io(err: std::io::Error) -> Self {
|
||||
let code = match err.kind() {
|
||||
std::io::ErrorKind::NotFound => AppErrorCode::NotFound,
|
||||
|
||||
@@ -421,10 +421,7 @@ fn parse_error_to_app_error(error: ParseError) -> AppCommandError {
|
||||
AppCommandError::invalid_input("Failed to parse conversation file")
|
||||
.with_detail(err.to_string())
|
||||
}
|
||||
ParseError::Db(err) => AppCommandError::new(
|
||||
crate::app_error::AppErrorCode::DatabaseError,
|
||||
"Database operation failed",
|
||||
)
|
||||
ParseError::Db(err) => AppCommandError::database_error("Database operation failed")
|
||||
.with_detail(err.to_string()),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,6 @@ pub enum DbError {
|
||||
Database(#[from] sea_orm::DbErr),
|
||||
#[error("migration error: {0}")]
|
||||
Migration(String),
|
||||
#[allow(dead_code)]
|
||||
#[error("database not initialized")]
|
||||
NotInitialized,
|
||||
#[error("io error: {0}")]
|
||||
Io(#[from] std::io::Error),
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@ use error::DbError;
|
||||
use migration::Migrator;
|
||||
|
||||
pub struct AppDatabase {
|
||||
#[allow(dead_code)]
|
||||
pub conn: DatabaseConnection,
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ pub enum ParseError {
|
||||
Db(#[from] sea_orm::DbErr),
|
||||
#[error("Conversation not found: {0}")]
|
||||
ConversationNotFound(String),
|
||||
#[allow(dead_code)]
|
||||
#[error("Invalid data: {0}")]
|
||||
InvalidData(String),
|
||||
}
|
||||
|
||||
@@ -14,8 +14,7 @@ use super::types::{TerminalEvent, TerminalInfo};
|
||||
struct TerminalInstance {
|
||||
write_tx: mpsc::Sender<Vec<u8>>,
|
||||
master: Box<dyn MasterPty + Send>,
|
||||
#[allow(dead_code)]
|
||||
child: Box<dyn portable_pty::Child + Send>,
|
||||
_child: Box<dyn portable_pty::Child + Send>,
|
||||
title: String,
|
||||
owner_window_label: String,
|
||||
}
|
||||
@@ -185,7 +184,7 @@ impl TerminalManager {
|
||||
let instance = TerminalInstance {
|
||||
write_tx,
|
||||
master: pair.master,
|
||||
child,
|
||||
_child: child,
|
||||
title: "Terminal".to_string(),
|
||||
owner_window_label,
|
||||
};
|
||||
@@ -264,7 +263,7 @@ impl TerminalManager {
|
||||
// Windows ConPTY may not always surface EOF promptly; reconcile exited
|
||||
// child processes here so frontend running-state can recover reliably.
|
||||
for (id, instance) in terminals.iter_mut() {
|
||||
match instance.child.try_wait() {
|
||||
match instance._child.try_wait() {
|
||||
Ok(Some(_)) => exited_terminal_ids.push(id.clone()),
|
||||
Ok(None) => {}
|
||||
Err(err) => {
|
||||
@@ -332,8 +331,8 @@ impl TerminalManager {
|
||||
}
|
||||
|
||||
fn terminate_terminal(instance: &mut TerminalInstance) {
|
||||
let _ = instance.child.kill();
|
||||
let _ = instance.child.wait();
|
||||
let _ = instance._child.kill();
|
||||
let _ = instance._child.wait();
|
||||
}
|
||||
|
||||
fn write_loop(mut writer: Box<dyn Write + Send>, rx: mpsc::Receiver<Vec<u8>>) {
|
||||
|
||||
Reference in New Issue
Block a user