Skip to content

fix(useless_conversion): ignore From::from in generated code - #17583

Merged
Manishearth merged 1 commit into
rust-lang:masterfrom
NicDevTV:fix/useless-conversion-generated-code
Sep 2, 2026
Merged

Manishearth merged 1 commit into
rust-lang:masterfrom
NicDevTV:fix/useless-conversion-generated-code

Conversation

@NicDevTV

@NicDevTV NicDevTV commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Fixes useless_conversion being triggered for From::from(...) in #[automatically_derived] code.

The lint now skips those cases and the UI test has been updated accordingly.

I used an LLM to help understand parts of the codebase and explore the approach. The final change was reviewed, understood and implemented by me.

changelog: [useless_conversion]: Don't lint From::from in automatically derived code

Fixes #17083

@rustbot

rustbot commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the pull request, and welcome!

You should hear from one of our reviewers after this PR gets at least 2 reviews from the community.

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 (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rustbot rustbot added S-waiting-on-community-reviews Status: This is awaiting for positive reviews from the community before a maintainer is assigned. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels Aug 17, 2026

@CommanderStorm CommanderStorm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Community review:

Code itsself is good, but on the tests this could be a bit cleaner to not "litter" 😉

View changes since this review

Comment thread tests/ui/useless_conversion.fixed Outdated

@CommanderStorm CommanderStorm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Community review: LGTM, but please squash the commits into one, so this does not take an review cycle 😉

View changes since this review

@NicDevTV
NicDevTV force-pushed the fix/useless-conversion-generated-code branch from 12684da to 1e9b5e4 Compare August 17, 2026 20:57
@NicDevTV

Copy link
Copy Markdown
Contributor Author

like this @CommanderStorm ?

@CommanderStorm

Copy link
Copy Markdown
Contributor

yes, tnx

@blyxyas

blyxyas commented Aug 21, 2026

Copy link
Copy Markdown
Member

Hello @NicDevTV, seems that an LLM assisted in this PR, we require disclosure as per the LLM policy

@NicDevTV

Copy link
Copy Markdown
Contributor Author

@blyxyas Yes, I used an LLM while working on this PR. I used it to help me understand parts of the codebase and to explore a possible solution approach. I reviewed and understood the approach myself and implemented the actual changes on my own.

@blyxyas

blyxyas commented Aug 31, 2026

Copy link
Copy Markdown
Member

In that case, please follow our LLM policy and reword your PR description accordingly
(ฅ`・ω・´)っ=

@Gri-ffin Gri-ffin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you also link the issue using fixes #17083.

View changes since this review

Comment thread clippy_lints/src/useless_conversion.rs Outdated
@NicDevTV
NicDevTV force-pushed the fix/useless-conversion-generated-code branch from 1e9b5e4 to 4f9cf04 Compare September 2, 2026 13:52

@Gri-ffin Gri-ffin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@rustbot rustbot removed the S-waiting-on-community-reviews Status: This is awaiting for positive reviews from the community before a maintainer is assigned. label Sep 2, 2026
@rustbot

rustbot commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

r? @Manishearth

rustbot has assigned @Manishearth for the project review.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: 9 candidates
  • 9 candidates expanded to 9 candidates
  • Random selection from 6 candidates

@Manishearth Manishearth left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems fine. Would like to know which actual derive uses From, but this makes sense anyway.

View changes since this review

@Manishearth
Manishearth added this pull request to the merge queue Sep 2, 2026
Merged via the queue into rust-lang:master with commit ed158e7 Sep 2, 2026
11 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Sep 2, 2026
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.

useless_conversion is triggered in generated code

6 participants