refactor: remove unused HasThresholdStyle impls and apply PR #108 sub-field boilerplate refactor#126
Merged
2 commits merged intomainfrom Mar 27, 2026
Conversation
…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>
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
Owner
Author
|
Hold this pending PR #118 resolution |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CostSubfieldConfigandContextWindowSubfieldConfiginto a singleSubfieldConfigstruct insrc/config.rs, addsHasThresholdStyletrait andimpl_has_threshold_style!macro, and addsrender_styled_value()tosrc/format.rs.HasThresholdStyleimpls (CostConfig,ContextBarConfig,UsageLimitsConfig) — these were never cast to&dyn HasThresholdStyleanywhere in the codebase.src/modules/cost.rs(5 subfield functions) andsrc/modules/context_window.rs(8 subfield functions) withrender_styled_value()calls.Test plan
cargo buildexits 0 with no errorscargo testpasses all 65 tests with no regressionscargo clippy -- -D warningsexits 0 (no new warnings introduced)impl HasThresholdStyle for ContextWindowConfigis the onlyHasThresholdStyleimpl (the used one)CostSubfieldConfigandContextWindowSubfieldConfigremain as#[cfg(test)]aliases for backward-compatible test code🤖 Generated with Claude Code