Skip to content

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

Open
NicDevTV wants to merge 1 commit into
rust-lang:masterfrom
NicDevTV:fix/useless-conversion-generated-code
Open

fix(useless_conversion): ignore From::from in generated code#17583
NicDevTV wants to merge 1 commit into
rust-lang:masterfrom
NicDevTV:fix/useless-conversion-generated-code

Conversation

@NicDevTV

@NicDevTV NicDevTV commented Aug 17, 2026

Copy link
Copy Markdown

Summary

useless_conversion reported false positives for redundant From::from calls inside #[automatically_derived] implementations involving generic associated types.

This change skips that specific lint case for automatically derived code while preserving the existing behavior for regular code and other conversion methods. A regression UI test based on #17083 was added.

Testing

  • cargo fmt --all -- --check
  • git diff --check
  • Targeted useless_conversion UI tests
  • Full UI test suite
  • Full ui-toml test suite
  • Repository validation tests

The complete cargo test suite could not be run locally because some dependencies were unavailable in the offline environment.

changelog: [useless_conversion]: Avoid linting redundant From::from conversions in automatically derived implementations.

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
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

useless_conversion is triggered in generated code

4 participants