feat: enhance strictness of Rust compiler settings and improve code quality by treating warnings as errors

This commit is contained in:
asepharyana
2026-07-13 06:22:31 +07:00
parent 3f5f27c339
commit 5334c2501b
20 changed files with 95 additions and 108 deletions
-8
View File
@@ -44,7 +44,6 @@ pub struct ToolCtx {
pub workspaces: Vec<PathBuf>,
pub session_dir: PathBuf,
pub memory_dir: PathBuf,
pub _download_dir: PathBuf,
pub worktrees_dir: PathBuf,
pub dir_cache: std::sync::Arc<tokio::sync::RwLock<super::app::state::misc::DirCache>>,
pub origin: crate::app::state::types::Origin,
@@ -87,7 +86,6 @@ pub struct ToolCtxBuilder {
pub workspaces: Vec<PathBuf>,
pub session_dir: PathBuf,
pub memory_dir: PathBuf,
pub download_dir: PathBuf,
pub worktrees_dir: PathBuf,
pub dir_cache: std::sync::Arc<tokio::sync::RwLock<super::app::state::misc::DirCache>>,
pub origin: crate::app::state::types::Origin,
@@ -103,7 +101,6 @@ impl Default for ToolCtxBuilder {
workspaces: Vec::new(),
session_dir: PathBuf::new(),
memory_dir: PathBuf::new(),
download_dir: PathBuf::new(),
worktrees_dir: PathBuf::new(),
dir_cache: std::sync::Arc::new(tokio::sync::RwLock::new(super::app::state::misc::DirCache::new())),
origin: crate::app::state::types::Origin::Main,
@@ -122,9 +119,6 @@ impl ToolCtxBuilder {
pub fn workspaces(mut self, v: Vec<PathBuf>) -> Self { self.workspaces = v; self }
/// Set the origin (main process vs. daemon-attached).
pub fn origin(mut self, v: crate::app::state::types::Origin) -> Self { self.origin = v; self }
/// Set the lsp_manager.
#[allow(dead_code)]
pub fn lsp_manager(mut self, v: Arc<Mutex<crate::app::lsp::LspManager>>) -> Self { self.lsp_manager = v; self }
/// Set the workflow-level findings sharing Arc (for subagent-to-subagent
/// communication within a workflow run).
pub fn workflow_findings(mut self, v: Option<Arc<Mutex<Vec<String>>>>) -> Self { self.workflow_findings = v; self }
@@ -134,7 +128,6 @@ impl ToolCtxBuilder {
workspaces: self.workspaces,
session_dir: self.session_dir,
memory_dir: self.memory_dir,
_download_dir: self.download_dir,
worktrees_dir: self.worktrees_dir,
dir_cache: self.dir_cache,
origin: self.origin,
@@ -228,7 +221,6 @@ pub fn tool_defs(tools: &[Box<dyn Tool>]) -> Vec<crate::dto::provider::request::
/// Return: the canonical absolute path, or an error if the workspace index is invalid
/// or the resolved path falls outside all workspace roots.
pub fn resolve_path(workspaces: &[PathBuf], rel: &str) -> Result<PathBuf> {
let _parts: Vec<&str> = rel.splitn(2, '/').collect();
let (ws_idx, path) = if rel.starts_with('[') {
let close = rel.find(']').ok_or_else(|| anyhow::anyhow!("invalid workspace prefix"))?;
let idx: usize = rel[1..close].parse().map_err(|_| anyhow::anyhow!("invalid workspace index"))?;