Repository navigation
Silence clippy::redundant_field_names in derive(Query) output - #482
Merged
Merged
Conversation
The generated `Query::get` builds the item struct from intermediate bindings named after the fields they initialize, so every field of a `#[derive(Query)]` struct or enum variant triggers `clippy::redundant_field_names` in the user's crate, where the lint cannot be addressed. Closes Ralith#481 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q9q9u6LVGiugiXESP56EQK Signed-off-by: qwist1233-cpu <[email protected]>
Ralith
requested changes
Nov 9, 2026
Ralith
left a comment
Owner
There was a problem hiding this comment.
Thanks! Please drop the comments; this is pretty self-explanatory in context.
Another option would be to generate the code clippy would prefer, but only if that code would be at most as complex as the status quo; better to allow the lint than to make the macro harder to maintain.
Contributor
Author
|
Done — dropped the comments, the diff is now just the two |
Ralith
approved these changes
Nov 11, 2026
Ralith
enabled auto-merge (squash)
November 11, 2026 18:27
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.
derive(Query)emitsQuery::getasThe intermediate bindings are named after the fields they initialize, so every field of a
#[derive(Query)]struct — and every field of a derived enum's variants — firesclippy::redundant_field_names. The diagnostic points at the user's own field declarations,so a downstream crate cannot address it except by putting an
allowon each query type.This adds the lint to the
#[allow(...)]that already sits on both generatedgetimplementations (struct and enum). No change to the generated logic.
Verification
The struct from the issue, plus an enum query, compiled against this branch and against
masterwithcargo clippyon stable (run log):macros/src/query.rsfromredundant field nameswarningsmastercargo test -p hecs --features macrosin the same run: 32 passed, 0 failed.Closes #481
🤖 Generated with Claude Code
https://claude.ai/code/session_01Q9q9u6LVGiugiXESP56EQK