Write Rust code so its intent is clear at a glance and responsibilities are placed correctly.
Apply this checklist:
if edit && fork / else if shapes into a single flow that reuses the right helper methods.Example pattern for readability (intermediate variables + simplified conditions):
let requested_budget = thinking_budget_tokens(model_config);
let max_thinking_budget = max_tokens.saturating_sub(MIN_ANSWER_TOKENS);
let budget_tokens = requested_budget.min(max_thinking_budget);
if budget_tokens >= MIN_THINKING_BUDGET_TOKENS {
// build the thinking config using budget_tokens
}