refactor: consolidate #![allow(clippy::cast_*)] to crate roots

Add the cast-allow block to zesdex-entities/src/lib.rs and
zesdex-utils/src/lib.rs (which lacked it), then remove from
65 sub-files across all 8 crates. Build and all 223 tests
continue to pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
asepharyana
2026-07-18 03:18:27 +07:00
co-authored by Claude Opus 4.8
parent 4cd38c9291
commit 7d8487cefb
67 changed files with 14 additions and 415 deletions
@@ -1,9 +1,3 @@
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
//! Global registry of running background bash jobs, and control operations
//! (output polling, kill) exposed to the rest of the app.
//!
@@ -1,9 +1,3 @@
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
//! Effort mode: cycles the agent's reasoning effort level, which scales the
//! LLM's temperature and `max_tokens` for subsequent turns.
use crate::app::state::rest::AppStateRest;
@@ -1,9 +1,3 @@
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
//! Rewind mode: restores a file to a pre-edit snapshot stored in the
//! session's `SQLite` blob store.
use crate::app::state::rest::AppStateRest;
@@ -1,9 +1,3 @@
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
//! Build/test probing: running a verification command and capturing its
//! pass/fail/timeout outcome for the review subagent.
@@ -16,8 +16,6 @@
//! running turns on plain OS threads (rather than blocking the main loop)
//! keeps the TUI responsive while the LLM streams.
#![allow(clippy::cast_possible_truncation, clippy::cast_sign_loss, clippy::cast_precision_loss, clippy::cast_possible_wrap)]
mod handlers;
mod io;
mod memory;
@@ -1,9 +1,3 @@
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
//! Shared small state types: toasts, overlays, the transcript cache,
//! tool execution model, and call origin tags.
use serde::{Deserialize, Serialize};
@@ -1,9 +1,3 @@
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
//! Tool: `edit` — replace a substring in a file with a new string.
use super::super::check_graduated_checks;
use super::super::resolve_path;
@@ -1,9 +1,3 @@
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
//! Tool: `read` — display file contents with line numbers.
use super::super::resolve_path;
use super::super::Tool;
@@ -1,10 +1,3 @@
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
mod connect;
mod completion;
mod definition;
-6
View File
@@ -1,9 +1,3 @@
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
//! Chat transcript panel rendering — tight inline log style.
//!
//! Flow: `draw_chat` turns `state.transcript_cache.messages` into a dense,
-6
View File
@@ -1,9 +1,3 @@
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
//! Top-level TUI render pipeline: layouts the terminal into chat / input
//! / status regions, dispatches overlay rendering with glassmorphism-style
//! centered panels, and floats toast notifications over the top-right corner.
-6
View File
@@ -1,9 +1,3 @@
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
//! Status bar rendering for the TUI — modern segmented bar design.
//!
//! Flow: `draw_status_bar` reads live connection/turn state off
@@ -3,13 +3,6 @@
//! `ConversationServiceImpl` is generic over `R: ConversationRepository`,
//! delegating all persistence to that adapter.
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
use anyhow::{Context, Result};
use crate::domain::conversation::{ChatMessage, Conversation};
@@ -3,13 +3,6 @@
//! `MemoryServiceImpl` is generic over `R: MemoryRepository`, delegating
//! all persistence to that adapter.
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
use anyhow::{Context, Result};
use crate::domain::memory::Memory;
-7
View File
@@ -3,13 +3,6 @@
//! Each service is generic over its repository trait so the concrete
//! persistence adapter is injected at composition root.
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
pub mod conversation_service;
pub mod memory_service;
pub mod settings_service;
@@ -3,13 +3,6 @@
//! `SettingsServiceImpl` is generic over `S: SettingsRepository` and
//! `C: AppConfigRepository`, delegating all persistence to those adapters.
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
use anyhow::Result;
use crate::domain::app_config::{AppConfig, ProviderConfig};
@@ -5,13 +5,6 @@
//! This is a pure data structure with **no I/O logic**. Load/save
//! responsibilities live in [`AppConfigRepository`](super::repository::AppConfigRepository).
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
use std::collections::HashMap;
use serde::{Deserialize, Serialize};
-7
View File
@@ -4,13 +4,6 @@
//! This is a pure data structure with **no I/O logic**. Load/save
//! responsibilities live in [`EditLogRepository`](super::repository::EditLogRepository).
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
use serde::{Deserialize, Serialize};
/// A single recorded file edit: which tool made it, to which path, why,
-7
View File
@@ -5,13 +5,6 @@
//! This is a pure data structure with **no I/O logic**. Load/save
//! responsibilities live in [`MemoryRepository`](super::repository::MemoryRepository).
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
use std::path::{Path, PathBuf};
use serde::{Deserialize, Serialize};
-7
View File
@@ -3,13 +3,6 @@
//! This layer has zero infrastructure dependencies; all I/O is expressed through
//! repository traits defined in [`repository`].
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
pub mod app_config;
pub mod conversation;
pub mod edit_log;
@@ -4,13 +4,6 @@
//! adapters implement. The domain and application layers depend only on
//! these traits, never on concrete persistence implementations.
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
use std::path::Path;
use anyhow::Result;
-7
View File
@@ -3,13 +3,6 @@
//! These traits are implemented by the application layer and consumed by
//! infrastructure adapters (HTTP handlers, CLI commands, etc.).
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
use anyhow::Result;
use super::conversation::{ChatMessage, Conversation};
-7
View File
@@ -5,13 +5,6 @@
//! This is a pure data structure with **no I/O logic**. Load/save
//! responsibilities live in [`SettingsRepository`](super::repository::SettingsRepository).
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
use std::collections::HashMap;
use serde::{Deserialize, Serialize};
@@ -4,13 +4,6 @@
//! They are independent of the domain entities so the API contract can
//! evolve without coupling to the domain model.
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
use serde::{Deserialize, Serialize};
// ---------------------------------------------------------------------------
@@ -5,13 +5,6 @@
//! HTTP framework — callers (e.g. Axum routes) are responsible for mapping
//! `Result` into HTTP responses.
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
use anyhow::{Context, Result};
use crate::domain::memory::Memory;
@@ -1,12 +1,5 @@
//! HTTP adapter — handler functions and DTOs for CMS REST endpoints.
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
pub mod dto;
pub mod handlers;
@@ -2,12 +2,5 @@
//!
//! Contains persistence implementations (file I/O) and HTTP handler adapters.
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
pub mod http;
pub mod persistence;
@@ -5,13 +5,6 @@
//! On load, auto-detects Claude credentials from the environment or
//! `~/.claude/settings.json` and merges them into the provider map.
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
use std::path::Path;
use anyhow::{Context, Result};
@@ -4,13 +4,6 @@
//!
//! Uses write-then-rename with fsync for crash safety.
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
use std::path::Path;
use anyhow::{Context, Result};
@@ -5,13 +5,6 @@
//! Append-only log: new entries are appended to the file, never rewritten.
//! In-memory cache is capped at 10K entries to prevent unbounded growth.
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
use std::io::{BufRead, BufReader, Write};
use std::path::Path;
@@ -7,13 +7,6 @@
//! name, description, kind, created_at, updated_at, lifecycle,
//! outcome, scope, before, after, provenances
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
use std::collections::HashMap;
use std::io::Write;
use std::path::Path;
@@ -1,12 +1,5 @@
//! Persistence adapters — concrete file-based repository implementations.
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
pub mod app_config_repo;
pub mod conversation_repo;
pub mod edit_log_repo;
@@ -4,13 +4,6 @@
//!
//! Uses write-then-rename with fsync for crash safety.
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
use std::path::Path;
use anyhow::{Context, Result};
@@ -1,9 +1,3 @@
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
//! Session metadata: id, title, workspace roots, and message/token counts,
//! persisted as `session.json` per session directory.
use chrono::Utc;
@@ -1,9 +1,3 @@
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
//! PID-file based advisory lock preventing two processes from operating on
//! the same session directory concurrently.
use std::fs;
@@ -1,9 +1,3 @@
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
//! In-memory conversation state: message history plus the system prompt and
//! model parameters used to drive the LLM.
use serde::{Deserialize, Serialize};
@@ -1,9 +1,3 @@
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
//! Chat message types shared across the entity layer: `Role` and `ChatMessage`
//! with convenience constructors.
use serde::{Deserialize, Serialize};
@@ -1,9 +1,3 @@
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
//! Provider-facing DTOs: chat completion request, response, streaming types,
//! and the SSE stream parser.
use serde::{Deserialize, Serialize};
@@ -1,9 +1,3 @@
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
//! Filesystem layout for zesdex's persistent and scratch data directories.
use serde::{Deserialize, Serialize};
use std::path::PathBuf;
@@ -1,9 +1,3 @@
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
//! Tool-call DTOs embedded in assistant chat messages.
//!
//! Flow: provider response/stream carries `tool_calls` on an assistant
@@ -1,9 +1,3 @@
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
//! Record of one completed tool invocation, kept for transcript/history.
use serde::{Deserialize, Serialize};
@@ -1,9 +1,3 @@
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
//! Token usage accounting shared by streaming and non-streaming responses.
use serde::{Deserialize, Serialize};
+7
View File
@@ -1,3 +1,10 @@
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
//! Domain entity types for the Zesdex application.
//!
//! This crate contains ALL domain entity types as pure data structures
@@ -1,9 +1,3 @@
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
//! OAuth flow use-cases.
//!
//! `OAuthServiceImpl` drives the authorization-code + PKCE flow:
@@ -1,9 +1,3 @@
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
//! Session management use-cases.
//!
//! `SessionServiceImpl` implements `SessionService` by delegating to
-6
View File
@@ -1,9 +1,3 @@
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
//! Pure OAuth entities — no HTTP or persistence logic.
use serde::{Deserialize, Serialize};
@@ -1,9 +1,3 @@
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
//! Repository trait definitions (pure — no impls, no concrete persistence).
use std::path::Path;
-6
View File
@@ -1,9 +1,3 @@
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
//! Service trait definitions — use-case interfaces for session management
//! and OAuth flows.
use crate::domain::oauth::{OAuthConfig, OAuthToken};
@@ -1,9 +1,3 @@
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
//! IAM-specific HTTP / IPC DTOs (Data Transfer Objects).
use serde::{Deserialize, Serialize};
@@ -1,9 +1,3 @@
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
//! IPC / HTTP handler functions.
//!
//! Each handler is a plain function that takes a service reference and a
@@ -1,9 +1,3 @@
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
//! Minimal loopback HTTP server for capturing OAuth authorization-code redirects.
//!
//! Ported from `zesdex-backend::service::oauth::loopback` to centralise OAuth
@@ -1,9 +1,3 @@
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
//! Filesystem-backed `OAuthRepository` implementation.
//!
//! Tokens are stored as a single JSON file. Writes use a write-then-rename
@@ -1,9 +1,3 @@
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
//! Filesystem-backed `SessionRepository` implementation.
//!
//! Each session is stored as `<base_dir>/sessions/<id>/session.json`.
-6
View File
@@ -1,9 +1,3 @@
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
//! SQLite database connection pool initialisation and schema migrations.
//!
//! Uses `r2d2` + `r2d2_sqlite` for connection pooling with the same
-6
View File
@@ -1,9 +1,3 @@
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
//! JWT token utilities for HMAC-SHA256 / HS256 signing and verification.
//!
//! Uses the `jsonwebtoken` crate under the hood.
-6
View File
@@ -1,9 +1,3 @@
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
//! Argon2 password hashing and verification utilities.
//!
//! Uses the `argon2` crate (Argon2id variant) with default parameters,
-6
View File
@@ -1,9 +1,3 @@
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
//! Application state initialisation and wiring.
//!
//! This module acts as the composition root for the zesdex daemon (and
-7
View File
@@ -9,13 +9,6 @@
//! The length prefix **excludes** itself — it encodes only the number of
//! payload bytes that follow.
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
use anyhow::{Context, Result};
use std::io::{Read, Write};
-7
View File
@@ -5,13 +5,6 @@
//! [`DaemonFrame`] are serialised as JSON messages framed with a
//! length prefix (see [`crate::frame`]).
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
use serde::{Deserialize, Serialize};
// ---------------------------------------------------------------------------
-7
View File
@@ -4,13 +4,6 @@
//! [`IpcServer`] wraps a [`UnixListener`] and provides a blocking
//! `accept` method that returns a [`Connection`] for each new client.
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
use crate::conn::Connection;
use anyhow::{Context, Result};
use std::os::unix::net::UnixListener;
-6
View File
@@ -1,9 +1,3 @@
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
//! Authentication middleware — session-lock based auth for Axum.
//!
//! Provides:
-6
View File
@@ -1,9 +1,3 @@
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
//! CORS layer factory for the daemon HTTP (IPC) server.
//!
//! Since the daemon only listens on `127.0.0.1`, the CORS policy is
-7
View File
@@ -1,10 +1,3 @@
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
use std::fmt;
/// Unified error type for the zesdex codebase.
+7
View File
@@ -1,3 +1,10 @@
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
pub mod atomic_write;
pub use atomic_write::write_json_atomic;
pub mod clipboard;
-7
View File
@@ -1,10 +1,3 @@
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
use serde::{Deserialize, Serialize};
/// A generic paginated response.
-7
View File
@@ -1,10 +1,3 @@
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
/// Characters that are invalid in filenames on most operating systems.
const INVALID_FILENAME_CHARS: &[char] = &[
'/', '\0', '<', '>', ':', '"', '\\', '|', '?', '*', '\x01', '\x02', '\x03', '\x04', '\x05',
-7
View File
@@ -1,10 +1,3 @@
#![allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::cast_precision_loss,
clippy::cast_possible_wrap
)]
use std::path::{Path, PathBuf};
const MAX_SLUG_LENGTH: usize = 80;