Skip to content

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

Merged
2 commits merged intomainfrom
story-3-1-remove-unused-has-threshold-style-impls
Mar 27, 2026
Merged

refactor: remove unused HasThresholdStyle impls and apply PR #108 sub-field boilerplate refactor#126
2 commits merged intomainfrom
story-3-1-remove-unused-has-threshold-style-impls

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.

Test plan

  • cargo build exits 0 with no errors
  • cargo test passes all 65 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 10:29
…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.

@stephenleo
Copy link
Copy Markdown
Owner Author

Hold this pending PR #118 resolution

@stephenleo stephenleo closed this pull request by merging all changes into main in 2bf3ebd Mar 27, 2026
stephenleo added a commit that referenced this pull request Mar 27, 2026
revert: undo PR #126 and PR #128 (boilerplate refactor and type alias removal)
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