Skip to content

refactor: remove unused FormatDefault import from generated code#115

Merged
ya7010 merged 1 commit into
mainfrom
refactor/remove-unused-format-default-import
Jun 10, 2026
Merged

refactor: remove unused FormatDefault import from generated code#115
ya7010 merged 1 commit into
mainfrom
refactor/remove-unused-format-default-import

Conversation

@ya7010

@ya7010 ya7010 commented Jun 10, 2026

Copy link
Copy Markdown
Owner

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 is IntoError::into_error_by, and Message::new is an inherent function. The import was dead output, so this PR removes it from all eight quote! blocks in serde_valid_derive (the four files touched by #114 plus pattern.rs, enum.rs, multiple_of.rs, and unique_items.rs, which had the same vestigial import).

Note that the import caused no actual downstream warnings (rustc suppresses unused_imports for 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 — passes
  • cargo 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

derive マクロが生成するコードに含まれる
`use ::serde_valid::validation::error::FormatDefault;` は、
生成コード中で trait メソッドが一切呼ばれておらず死んだ import のため、
全8ファイルの quote! ブロックから削除する。

PR #114 のレビューで指摘されたフォローアップ。
生成コードのトークン削減のみで、動作・公開 API への影響なし。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@ya7010
ya7010 merged commit e200d1a into main Jun 10, 2026
3 checks passed
@ya7010
ya7010 deleted the refactor/remove-unused-format-default-import branch June 10, 2026 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant