refactor(ethexe): replace manual fmt::Display/Debug impls with derive_more#5521
Draft
grishasobol wants to merge 1 commit into
Draft
refactor(ethexe): replace manual fmt::Display/Debug impls with derive_more#5521grishasobol wants to merge 1 commit into
grishasobol wants to merge 1 commit into
Conversation
…_more Replaces 8 hand-written `fmt::Display`/`fmt::Debug` impls across the ethexe workspace with their `derive_more` equivalents: - `ethexe/blob-loader`: `BlobLoaderEvent` Debug (delegates to inner field). - `ethexe/node-loader`: `ValueProfile` Display (lowercase variant names). - `ethexe/cli`: `RawOrFormattedValue<C>` Display (forwards to inner). - `ethexe/malachite/core`: `Address` Display, `ValueId` Display + Debug (hex-encoded byte arrays). - `ethexe/malachite/service`: `MalachiteEvent` Display (per-variant). - `ethexe/common`: `HashOf<T>` and `MaybeHashOf<T>` Debug (use `shortname<T>`). The `shortname` helper now carries `#[allow(dead_code)]` because the `dead_code` lint does not trace function calls placed inside the `format_args!` invocations emitted by `derive_more::Debug`. Adds `derive_more` to the dependencies of crates that did not yet use it (`blob-loader`, `cli`, `node-loader`, `malachite-core`, `malachite`). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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
Replaces 8 hand-written
fmt::Display/fmt::Debugimpls across the ethexe workspace with theirderive_moreequivalents. Net -20 lines and the local format strings now live next to the type they format.Migrations
ethexe-blob-loaderBlobLoaderEventDebug#[debug("{_0:?}")]ethexe-node-loaderValueProfileDisplay#[display]ethexe-cliRawOrFormattedValue<C>Displayethexe-malachite-coreAddressDisplay0x{hex}ethexe-malachite-coreValueIdDisplay+Debug0x{hex}/ValueId(0x{hex})ethexe-malachiteMalachiteEventDisplay#[display]ethexe-commonHashOf<T>DebugHashOf<short>({hash:?})ethexe-commonMaybeHashOf<T>DebugMaybeHashOf<short>({option_string})Skipped (kept manual)
CoordinatorBoot::Debug— usesdebug_struct(..).finish_non_exhaustive().AlternateCollectionFmt::Debug— branches onf.alternate().FormattedValue::Display,LoadRunReport::Display— non-trivial logic (trim trailing zeros, build pretty multi-line summaries).Notes
shortname<T>()helper inethexe/common/src/hash.rsis now flagged by thedead_codelint because rustc does not trace function calls placed inside theformat_args!invocations emitted byderive_more::Debug.cargo expandconfirms the function is still called; the macro-generated code readsformat_args!("HashOf<{0}>({1:?})", shortname::<T>(), hash). An#[allow(dead_code)]is added with a comment explaining this.derive_moreto the dependencies of crates that did not yet use it (blob-loader,cli,node-loader,malachite-core,malachite).Test plan
cargo check --workspace --all-targetsis clean.cargo nextest run -p ethexe-common -p ethexe-blob-loader -p ethexe-node-loader -p ethexe-cli -p ethexe-malachite-core -p ethexe-malachite— 183 passed, 1 leaky (pre-existingtest_formatted_valuehandle leak, test result reports1 passed; 0 failed).🤖 Generated with Claude Code