-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
New lint: detect unnecessary struct building #10489
Conversation
r? @giraffate (rustbot has picked a reviewer for you, use r? to override) |
b1ea128
to
ce3937c
Compare
☔ The latest upstream changes (presumably #10481) made this pull request unmergeable. Please resolve the merge conflicts. |
ce3937c
to
0e47ff5
Compare
☔ The latest upstream changes (presumably #10483) made this pull request unmergeable. Please resolve the merge conflicts. |
0e47ff5
to
afc939d
Compare
I'll review this in this week. |
/// let b = a; | ||
/// ``` | ||
#[clippy::version = "1.70.0"] | ||
pub UNNECESSARY_STRUCT, |
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 lint detects an unnecessary struct initialization, so, for example, how about the name UNNCESSARY_STRUCT_INITIALIZATION
?
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.
Good idea. Fixed.
afc939d
to
3c339ee
Compare
3c339ee
to
d7d3dbf
Compare
@bors r+ Thanks! |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Fixes #10476.
Running this lint on the top 500 crates produced one hit (in
rust-lang/rust-bindgen
) and a PR has been submitted there.changelog: [
unnecessary_struct_initialization
]: new lint