diff --git a/crates/palette/src/adapt.rs b/crates/palette/src/adapt.rs index 7f8ee41179..9b5d821f16 100644 --- a/crates/palette/src/adapt.rs +++ b/crates/palette/src/adapt.rs @@ -693,7 +693,6 @@ impl ColorDepth { /// palette; ANSI-16 uses a generic nearest named color. Rendered semantic /// foregrounds must go through [`adapt_fg_for_depth`] so role identity is not /// inferred from RGB proximity. -#[allow(dead_code)] #[must_use] pub fn adapt_color(color: Color, depth: ColorDepth) -> Color { match (color, depth) { @@ -708,7 +707,6 @@ pub fn adapt_color(color: Color, depth: ColorDepth) -> Color { /// Adapt a background color. On Ansi16 terminals background tints are noisy, /// so we drop them to `Color::Reset` rather than attempt a coarse named-color /// match — a quiet background reads cleaner than a wrong one. -#[allow(dead_code)] #[must_use] pub fn adapt_bg(color: Color, depth: ColorDepth) -> Color { match (color, depth) { @@ -722,7 +720,6 @@ pub fn adapt_bg(color: Color, depth: ColorDepth) -> Color { /// Mix two RGB colors at `alpha` (0.0 = `bg`, 1.0 = `fg`). Anything that's not /// RGB falls back to `fg` — there's no meaningful alpha blend on a named /// palette entry. -#[allow(dead_code)] #[must_use] pub fn blend(fg: Color, bg: Color, alpha: f32) -> Color { let alpha = alpha.clamp(0.0, 1.0); @@ -773,7 +770,6 @@ pub fn pulse_brightness(color: Color, now_ms: u64) -> Color { /// `adapt_color` on Ansi16 terminals; we lean on hue dominance + lightness so /// brand colors land on the obviously-related named entry (sky → cyan, blue → /// blue, red → red, etc.) rather than dithering around grey. -#[allow(dead_code)] pub(crate) fn nearest_ansi16(r: u8, g: u8, b: u8) -> Color { let lum = (u16::from(r) + u16::from(g) + u16::from(b)) / 3; if lum < 24 { @@ -840,7 +836,6 @@ pub(crate) fn nearest_ansi16(r: u8, g: u8, b: u8) -> Color { /// Map an RGB color to the nearest xterm 256-color palette index. We use only /// the stable 6x6x6 cube and grayscale ramp (16..255), not the terminal's /// user-configurable 0..15 colors. -#[allow(dead_code)] pub(crate) fn rgb_to_ansi256(r: u8, g: u8, b: u8) -> u8 { const CUBE_LEVELS: [u8; 6] = [0, 95, 135, 175, 215, 255]; diff --git a/crates/palette/src/contrast.rs b/crates/palette/src/contrast.rs index b912808595..a3ae41cff5 100644 --- a/crates/palette/src/contrast.rs +++ b/crates/palette/src/contrast.rs @@ -27,10 +27,6 @@ pub const AA_BODY_CONTRAST: f32 = 4.5; /// Matches the WCAG 2.x AA threshold for large text and UI components (3:1). /// Status roles qualify because they are redundant by design — every status /// also carries a glyph and a word label, so color is never the only channel. -/// -/// Consumed by the theme audit below, which runs as a test gate rather than -/// at runtime — hence the `dead_code` allowance on this audit surface. -#[allow(dead_code)] pub const SECONDARY_CHROME_CONTRAST: f32 = 3.0; /// Relative luminance per WCAG 2.x, in `0.0..=1.0`. @@ -217,7 +213,6 @@ fn indexed_rgb(index: u8) -> (u8, u8, u8) { /// A single theme color pair that fails its contrast floor. See /// [`theme_contrast_violations`]. -#[allow(dead_code)] #[derive(Debug, Clone, Copy, PartialEq)] pub struct ThemeContrastViolation { /// Static name of the failing pair, e.g. `"text_muted on panel_bg"`. @@ -240,7 +235,6 @@ pub struct ThemeContrastViolation { /// so the audit neither passes nor fails them — it stands down. Deepsea paints /// its authored RGB column later. This function is how callers tell the Flat /// exemption apart from a clean bill of health. -#[allow(dead_code)] #[must_use] pub fn theme_uses_terminal_owned_surfaces(theme: &UiTheme) -> bool { theme.surface_bg == Color::Reset @@ -270,7 +264,6 @@ pub fn theme_uses_terminal_owned_surfaces(theme: &UiTheme) -> bool { /// terminal-native themes are therefore partly exempt by design — see /// [`theme_uses_terminal_owned_surfaces`], which makes that exemption explicit /// rather than silent. -#[allow(dead_code)] #[must_use] pub fn theme_contrast_violations(theme: &UiTheme) -> Vec { let mut violations = Vec::new(); diff --git a/crates/palette/src/grammar.rs b/crates/palette/src/grammar.rs index 75159353bc..170efd0c1d 100644 --- a/crates/palette/src/grammar.rs +++ b/crates/palette/src/grammar.rs @@ -12,7 +12,6 @@ use ratatui::style::{Color, Style}; use super::themes::UiTheme; /// The five visual families. Surface is the canvas, not a foreground ink. -#[cfg_attr(not(test), allow(dead_code))] #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum SemanticFamily { Surface, @@ -79,7 +78,6 @@ impl ChromeInk { ]; #[must_use] - #[cfg_attr(not(test), allow(dead_code))] pub const fn family(self) -> SemanticFamily { match self { Self::Outcome | Self::Active => SemanticFamily::Live, diff --git a/crates/runtime/src/model_context/fragment.rs b/crates/runtime/src/model_context/fragment.rs index c99e16bab6..1bfd00da6d 100644 --- a/crates/runtime/src/model_context/fragment.rs +++ b/crates/runtime/src/model_context/fragment.rs @@ -31,7 +31,6 @@ pub enum FragmentId { impl FragmentId { #[must_use] - #[allow(dead_code)] // public identity API for WorldState host adapters (TUI-DOG-011) pub fn as_str(self) -> &'static str { match self { Self::Workspace => "workspace", @@ -61,7 +60,6 @@ impl FragmentId { } #[must_use] - #[allow(dead_code)] // public identity API for WorldState host adapters (TUI-DOG-011) pub fn role(self) -> FragmentRole { match self { Self::Workspace => FragmentRole::Workspace, @@ -76,7 +74,6 @@ impl FragmentId { } #[must_use] - #[allow(dead_code)] // ordered enumeration for host rebuilds / inspectors (TUI-DOG-011) pub fn all() -> &'static [FragmentId] { &[ Self::Workspace, @@ -114,7 +111,6 @@ pub enum FragmentRole { impl FragmentRole { #[must_use] - #[allow(dead_code)] // public role labels for inspectors / diffs (TUI-DOG-011) pub fn as_str(self) -> &'static str { match self { Self::Workspace => "workspace", @@ -137,7 +133,6 @@ pub enum FragmentRender { /// New or changed content — inject the capped body. Updated { fragment: ModelContextFragment }, /// Fragment was present before and is now absent. - #[allow(dead_code)] // produced by WorldState::clear; hosts wire clear next (TUI-DOG-011) Cleared { marker: String }, } diff --git a/crates/runtime/src/retry_status.rs b/crates/runtime/src/retry_status.rs index 44300d934c..95ae4e12c5 100644 --- a/crates/runtime/src/retry_status.rs +++ b/crates/runtime/src/retry_status.rs @@ -41,7 +41,6 @@ type RateLimitPauses = HashMap; /// next request will fire — the UI subtracts `Instant::now()` from it /// to render a live countdown. #[derive(Debug, Clone)] -#[cfg_attr(not(test), allow(dead_code))] pub struct RetryBanner { /// 1-indexed retry attempt number (the first retry is attempt 1). pub attempt: u32, @@ -58,7 +57,7 @@ pub enum RetryState { #[default] Idle, /// A request is sleeping before retrying. Show countdown banner. - Active(#[cfg_attr(not(test), allow(dead_code))] RetryBanner), + Active(RetryBanner), /// All retries exhausted; show failure row until the next turn /// starts. `since` records when the row was set so a future polish /// pass can age it out automatically; today the engine clears it on diff --git a/crates/tui/src/approval_log.rs b/crates/tui/src/approval_log.rs index 227fb3d26e..113909f120 100644 --- a/crates/tui/src/approval_log.rs +++ b/crates/tui/src/approval_log.rs @@ -414,7 +414,6 @@ impl ApprovalReceiptStore { Self { sessions_dir } } - #[cfg_attr(test, allow(dead_code))] pub(crate) fn default_location() -> io::Result { crate::session_manager::default_sessions_dir().map(Self::new) } diff --git a/crates/tui/src/core/engine/dispatch.rs b/crates/tui/src/core/engine/dispatch.rs index fb008bef93..3073650378 100644 --- a/crates/tui/src/core/engine/dispatch.rs +++ b/crates/tui/src/core/engine/dispatch.rs @@ -27,7 +27,6 @@ const MAX_SCHEMA_CONTAINER_REPAIR_BYTES: usize = 64 * 1024; // === Types ============================================================ -#[allow(dead_code)] // `index` mirrors batch order for diagnostic ergonomics. pub(super) struct ToolExecOutcome { pub(super) index: usize, pub(super) id: String, diff --git a/crates/tui/src/llm_client/mod.rs b/crates/tui/src/llm_client/mod.rs index eb8b35f241..31272b5909 100644 --- a/crates/tui/src/llm_client/mod.rs +++ b/crates/tui/src/llm_client/mod.rs @@ -1077,11 +1077,9 @@ pub struct RetryConfig { pub respect_retry_after: bool, /// HTTP status codes that should trigger a retry - #[allow(dead_code)] // Used in tests via is_retryable_status() pub retryable_status_codes: Vec, /// Timeout for individual requests (seconds, 0 = no timeout) - #[allow(dead_code)] // Configuration field for retry consumers pub request_timeout: f64, /// Total timeout for all retry attempts (seconds, 0 = no total timeout) @@ -1106,7 +1104,6 @@ impl Default for RetryConfig { } } -#[allow(dead_code)] // Public builder API, used in tests impl RetryConfig { /// Creates a new `RetryConfig` with default values pub fn new() -> Self { diff --git a/crates/tui/src/route_billing.rs b/crates/tui/src/route_billing.rs index 9ec25b1408..f116c4f4c9 100644 --- a/crates/tui/src/route_billing.rs +++ b/crates/tui/src/route_billing.rs @@ -62,7 +62,6 @@ impl BillingPresentation { } #[must_use] - #[allow(dead_code)] // label helpers for non-metered chip copy (TUI-DOG-010) pub const fn label(self) -> Option<&'static str> { match self { Self::Metered => None, @@ -919,7 +918,6 @@ pub fn usage_chip( /// Compact footer/header chip text. `None` means omit the chip. #[must_use] -#[allow(dead_code)] // shared chip formatter for footer/sidebar siblings (TUI-DOG-010) pub fn format_usage_chip(chip: &UsageChip, locale: Locale) -> Option { match chip { UsageChip::Money(amount) => Some(amount.clone()), diff --git a/crates/tui/src/skills/mutation.rs b/crates/tui/src/skills/mutation.rs index 955728551e..d0f1676748 100644 --- a/crates/tui/src/skills/mutation.rs +++ b/crates/tui/src/skills/mutation.rs @@ -108,7 +108,6 @@ pub struct SkillMutationReceipt { #[allow(dead_code)] // surfaced by manager detail / future receipt toast pub action: SkillActionKind, pub name: String, - #[allow(dead_code)] // surfaced by manager detail / future receipt toast pub scope: SkillScope, pub safe_target_path: String, #[allow(dead_code)] // reserved for digest-diff UI diff --git a/crates/tui/src/tui/hotbar/actions.rs b/crates/tui/src/tui/hotbar/actions.rs index fa91469712..d0f85f938d 100644 --- a/crates/tui/src/tui/hotbar/actions.rs +++ b/crates/tui/src/tui/hotbar/actions.rs @@ -17,7 +17,7 @@ use codewhale_localization::{Locale, MessageId, tr}; pub const HOTBAR_COMPACT_LABEL_MAX_WIDTH: usize = 7; /// Result of firing a hotbar action. -#[allow(dead_code, clippy::large_enum_variant)] // AppAction is intentionally large; boxing would force clone churn on the hot path +#[allow(clippy::large_enum_variant)] // AppAction is intentionally large; boxing would force clone churn on the hot path #[derive(Debug, Clone, PartialEq)] pub enum HotbarDispatch { /// The action was fully handled by mutating [`App`]. diff --git a/crates/tui/src/tui/transcript_cache.rs b/crates/tui/src/tui/transcript_cache.rs index d0ba728e0d..93d20805c9 100644 --- a/crates/tui/src/tui/transcript_cache.rs +++ b/crates/tui/src/tui/transcript_cache.rs @@ -134,7 +134,6 @@ impl TranscriptCache { /// Drop every cached entry. Used when the underlying transcript shape /// changes drastically (e.g. session reset). - #[allow(dead_code)] // Reserved for /clear and session-reset call sites. pub fn clear(&mut self) { self.entries.clear(); self.insertion_order.clear(); diff --git a/crates/tui/src/tui/widgets/tool_card.rs b/crates/tui/src/tui/widgets/tool_card.rs index 7cae159298..45eb23a3a3 100644 --- a/crates/tui/src/tui/widgets/tool_card.rs +++ b/crates/tui/src/tui/widgets/tool_card.rs @@ -315,7 +315,6 @@ pub fn family_label(family: ToolFamily) -> &'static str { /// Position of a line within a multi-line card — drives the left-rail /// glyph so the box reads as a contiguous group from top to bottom. #[derive(Debug, Clone, Copy, PartialEq, Eq)] -#[allow(dead_code)] // wired by future card-refactor follow-ups pub enum CardRail { /// First line of the card — the header. `╭`. Top, @@ -330,7 +329,6 @@ pub enum CardRail { /// Map a [`CardRail`] position to its rail glyph. Returned as a `&str` /// because callers paste it into a span. #[must_use] -#[allow(dead_code)] // wired by future card-refactor follow-ups pub fn rail_glyph(rail: CardRail) -> &'static str { match rail { CardRail::Top => "\u{256D}", // ╭ diff --git a/scripts/dead-code-budget.json b/scripts/dead-code-budget.json index 828825f306..1b1bf7bcd8 100644 --- a/scripts/dead-code-budget.json +++ b/scripts/dead-code-budget.json @@ -2,14 +2,10 @@ "_comment": "Ceiling for dead-code suppressions across crates/, counting both `#[allow(dead_code)]` and `#[expect(dead_code)]`. `total` is the sum and is the ratcheted figure. It may go down freely; raising it needs a reviewer to say why in the PR. Regenerate with: python3 scripts/check-dead-code-budget.py --update", "_issue": "https://github.com/codewhale-hq/CodeWhale/issues/4785", "_expect_blind_spot": "Until #6241 this gate counted only the `allow` spelling, so rewriting an allow as an expect lowered the number without removing any dead code. The ceiling was re-based to the true combined count when that was fixed; it is not a regression.", - "total": 258, - "allow_total": 175, - "expect_total": 83, + "total": 222, + "allow_total": 141, + "expect_total": 81, "per_crate": { - "app-server": { - "allow": 1, - "expect": 0 - }, "cli": { "allow": 0, "expect": 1 @@ -23,15 +19,15 @@ "expect": 0 }, "models": { - "allow": 5, + "allow": 3, "expect": 0 }, "palette": { - "allow": 20, + "allow": 9, "expect": 0 }, "runtime": { - "allow": 9, + "allow": 2, "expect": 2 }, "tools": { @@ -39,8 +35,8 @@ "expect": 0 }, "tui": { - "allow": 131, - "expect": 80 + "allow": 118, + "expect": 78 } } }