refactor(rust): dedupe emit-helper boilerplate across command crates#1438
Conversation
This was referenced May 19, 2026
Member
Author
|
This pull request is part of a Mergify stack:
|
This was referenced May 19, 2026
Contributor
Merge ProtectionsYour pull request matches the following merge protections and will not be merged until they are valid. 🔴 ⛓️ Depends-On RequirementsWaiting for
This rule is failing.Requirement based on the presence of
🔴 👀 Review RequirementsWaiting for
This rule is failing.
🔴 🔎 ReviewsWaiting for
This rule is failing.
🟢 🤖 Continuous IntegrationWonderful, this rule succeeded.
🟢 Enforce conventional commitWonderful, this rule succeeded.Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
🟢 📕 PR descriptionWonderful, this rule succeeded.
|
721eacd to
a6bf822
Compare
Member
Author
Revision history
|
A grab-bag of small DRY wins surfaced by the post-port review: - Add `Output::emit_json_value(&serde_json::Value)` to `mergify-core`. The `--json` passthrough commands (`queue status`, `queue show`, `freeze list`) all carried byte-identical `emit_json` private helpers that pretty-printed a value to either the JSON or the human sink. Centralize once. - Drop the `enabled_fg` wrapper in `queue show`: its body was exactly what `Theme::fg` already does, so call `theme.fg(...)` directly. Saves a helper + 13 call-site rewrites of the same redundant indirection. - Drop spurious `response.field.clone()` calls in `queue pause`, `config validate`, and `config simulate`. The closures handed to `Output::emit` borrow from the outer `&Response` parameter; the trait method doesn't require `'static`, so the clones were defensive noise. No behavior change. All workspace tests still pass. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Change-Id: Ied32eef956ebd71a03005530cc394612afd46e5d
50fcb0d to
f322a06
Compare
a6bf822 to
ac72c27
Compare
This was referenced May 19, 2026
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.
A grab-bag of small DRY wins surfaced by the post-port review:
Output::emit_json_value(&serde_json::Value)tomergify-core. The--jsonpassthrough commands (queue status,queue show,freeze list) all carried byte-identicalemit_jsonprivate helpers that pretty-printed a value to eitherthe JSON or the human sink. Centralize once.
enabled_fgwrapper inqueue show: its body wasexactly what
Theme::fgalready does, so calltheme.fg(...)directly. Saves a helper + 13 call-site rewrites of the same
redundant indirection.
response.field.clone()calls inqueue pause,config validate, andconfig simulate. The closures handed toOutput::emitborrow from the outer&Responseparameter; thetrait method doesn't require
'static, so the clones weredefensive noise.
No behavior change. All workspace tests still pass.
Co-Authored-By: Claude Opus 4.7 noreply@anthropic.com
Depends-On: #1437