Skip to content
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

Merged
merged 1 commit into from
Mar 24, 2023

Conversation

samueltardieu
Copy link
Contributor

@samueltardieu samueltardieu commented Mar 12, 2023

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

@rustbot
Copy link
Collaborator

rustbot commented Mar 12, 2023

r? @giraffate

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Mar 12, 2023
@samueltardieu samueltardieu marked this pull request as draft March 12, 2023 14:39
@samueltardieu samueltardieu reopened this Mar 12, 2023
@samueltardieu samueltardieu force-pushed the issue-10476 branch 3 times, most recently from b1ea128 to ce3937c Compare March 12, 2023 14:47
@samueltardieu samueltardieu marked this pull request as ready for review March 12, 2023 14:47
@bors
Copy link
Collaborator

bors commented Mar 16, 2023

☔ The latest upstream changes (presumably #10481) made this pull request unmergeable. Please resolve the merge conflicts.

@bors
Copy link
Collaborator

bors commented Mar 17, 2023

☔ The latest upstream changes (presumably #10483) made this pull request unmergeable. Please resolve the merge conflicts.

@giraffate
Copy link
Contributor

I'll review this in this week.

/// let b = a;
/// ```
#[clippy::version = "1.70.0"]
pub UNNECESSARY_STRUCT,
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. Fixed.

@giraffate
Copy link
Contributor

@bors r+

Thanks!

@bors
Copy link
Collaborator

bors commented Mar 24, 2023

📌 Commit d7d3dbf has been approved by giraffate

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Mar 24, 2023

⌛ Testing commit d7d3dbf with merge c72c914...

@bors
Copy link
Collaborator

bors commented Mar 24, 2023

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: giraffate
Pushing c72c914 to master...

@bors bors merged commit c72c914 into rust-lang:master Mar 24, 2023
@samueltardieu samueltardieu deleted the issue-10476 branch March 24, 2023 23:47
bors added a commit that referenced this pull request Mar 27, 2023
…rsery, r=flip1995

Move unnecessary_struct_initialization to nursery

changelog: none, assuming it makes into the same release as #10489

Mostly because of #10547 but there is also #10548
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Warn on redundant update
4 participants