Skip to content

refactor: remove unused HasThresholdStyle impls and apply PR #108 sub-field boilerplate refactor#132

Open
stephenleo wants to merge 3 commits intomainfrom
story-3-1-v2
Open

refactor: remove unused HasThresholdStyle impls and apply PR #108 sub-field boilerplate refactor#132
stephenleo wants to merge 3 commits intomainfrom
story-3-1-v2

Conversation

@stephenleo
Copy link
Copy Markdown
Owner

Summary

  • Applies the PR refactor: Reduce sub-field render boilerplate #108 sub-field boilerplate refactor: unifies CostSubfieldConfig and ContextWindowSubfieldConfig into a single SubfieldConfig struct in src/config.rs, adds HasThresholdStyle trait and impl_has_threshold_style! macro, and adds render_styled_value() to src/format.rs.
  • Removes the three unused HasThresholdStyle impls (CostConfig, ContextBarConfig, UsageLimitsConfig) — these were never cast to &dyn HasThresholdStyle anywhere in the codebase.
  • Replaces all inline threshold/style boilerplate in src/modules/cost.rs (5 subfield functions) and src/modules/context_window.rs (8 subfield functions) with render_styled_value() calls.

Re-submission of PR #126 after revert.

Test plan

  • cargo build exits 0 with no errors
  • cargo test passes all tests with no regressions
  • cargo clippy -- -D warnings exits 0 (no new warnings introduced)
  • Verify impl HasThresholdStyle for ContextWindowConfig is the only HasThresholdStyle impl (the used one)
  • Confirm CostSubfieldConfig and ContextWindowSubfieldConfig remain as #[cfg(test)] aliases for backward-compatible test code

🤖 Generated with Claude Code

stephenleo and others added 2 commits March 27, 2026 21:02
…sed HasThresholdStyle impls

- Merged CostSubfieldConfig and ContextWindowSubfieldConfig into a unified
  SubfieldConfig struct with #[cfg(test)] type aliases for backward compat.
- Added HasThresholdStyle trait and impl_has_threshold_style! macro to config.rs;
  only ContextWindowConfig gets an impl (the three unused CostConfig,
  ContextBarConfig, UsageLimitsConfig impls are intentionally absent per Story 3.1).
- Added render_styled_value() to format.rs with six unit tests covering all paths
  (format, threshold, invert_threshold, parent fallback, no-sub/no-parent).
- Replaced all inline threshold/style boilerplate in cost.rs (5 functions) and
  context_window.rs (8 functions) with render_styled_value() calls.
- cargo build, cargo test (65/65), and cargo clippy -- -D warnings all exit 0.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@claude
Copy link
Copy Markdown

claude bot commented Mar 27, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

1 similar comment
@claude
Copy link
Copy Markdown

claude bot commented Mar 27, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant