refactor: remove unused FormatDefault import from generated code#115
Merged
Conversation
derive マクロが生成するコードに含まれる `use ::serde_valid::validation::error::FormatDefault;` は、 生成コード中で trait メソッドが一切呼ばれておらず死んだ import のため、 全8ファイルの quote! ブロックから削除する。 PR #114 のレビューで指摘されたフォローアップ。 生成コードのトークン削減のみで、動作・公開 API への影響なし。 Co-Authored-By: Claude Opus 4.8 <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
Follow-up to the Copilot review findings on #114.
The code generated by the derive macros included
use ::serde_valid::validation::error::FormatDefault;, but the generated tokens never call any method of that trait — the only trait method invoked isIntoError::into_error_by, andMessage::newis an inherent function. The import was dead output, so this PR removes it from all eightquote!blocks inserde_valid_derive(the four files touched by #114 pluspattern.rs,enum.rs,multiple_of.rs, andunique_items.rs, which had the same vestigial import).Note that the import caused no actual downstream warnings (rustc suppresses
unused_importsfor proc-macro-expanded code, verified with a#![deny(unused_imports)]test crate), so this is purely a cleanup that slightly reduces the generated token output. No behavior or public API change.Validation
cargo build --workspace --all-features— passescargo test --workspace --all-features— all 32 test suites pass (doc-tests exercise every validator's generated code)cargo fmt -- --check/cargo clippy --workspace --all-features— zero warnings🤖 Generated with Claude Code