-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Respect allow inconsistent_struct_constructor
on the struct definition
#13211
Respect allow inconsistent_struct_constructor
on the struct definition
#13211
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Alexendoo (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
@Alexendoo It would be awesome if we get reviews on this somewhere before the next release; We'd love to see this in the upcoming version of Clippy, It allows us to skip writing a bunch of temporary constructors. On the other hand; If it is rejected, knowing it will help us start developing alternative approaches through builder methods. |
This won't land until at least |
Oh, I thought September was the stable cutoff that's why I was trying to push the review to an earlier date. Thanks for informing me mate, You've been really helpful to me in the past few days. I appreciate it. |
&& let Some(local_def_id) = adt_def.did().as_local() | ||
&& let ty_hir_id = cx.tcx.local_def_id_to_hir_id(local_def_id) | ||
&& !is_lint_allowed(cx, INCONSISTENT_STRUCT_CONSTRUCTOR, ty_hir_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can use fulfill_or_allow
just before the span_lint_and_sugg
so that #[expect]
also works
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I've missed this review in my notifications, Pushed a patch addressing this change request.
@rustbot review
Thank you! @bors r+ |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Closes #13203
Now we check if the target type is marked with
#[allow(clippy:inconsistent_struct_constructor)]
before lining.As a side-effect of this change, The rule in the subject no longer runs on non-local
AdtDef
s. However, as suggested by @Jarcho it shouldn't be a big deal since most of the time we didn't have access to this information anyway.changelog: Respect allow
inconsistent_struct_constructor
on the struct definition.