Skip to content

Moved lints from strings to methods - #17512

Open
MassimilianoBaglioni wants to merge 2 commits into
rust-lang:masterfrom
MassimilianoBaglioni:strings-to-method-refactor
Open

Moved lints from strings to methods#17512
MassimilianoBaglioni wants to merge 2 commits into
rust-lang:masterfrom
MassimilianoBaglioni:strings-to-method-refactor

Conversation

@MassimilianoBaglioni

@MassimilianoBaglioni MassimilianoBaglioni commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

changelog: none

Moves STRING_FROM_UTF8_AS_BYTES and TRIM_SPLIT_WHITESPACE from strings.rs into the shared Methods dispatch in methods.rs.

Questions:

  • TRIM_SPLIT_WHITESPACE now inherits the from_expansion() check in Methods::check_expr. It had no macro guard before. Tests still pass (no test covers macro-expanded call sites), but this is an untested behavior change worth flagging.
  • I tried moving STRING_LIT_AS_BYTES too, but some tests use macros, and the from_expansion() check in Methods::check_expr prevents the lint from firing on those cases, so tests failed. I kept it in strings.rs for now because of this. How should I proceed?
  • STR_TO_STRING not moved yet, one branch matches ExprKind::Path, not MethodCall, so it doesn't fit the shared dispatch. Should this get its own arm in check_expr, stay separate, or something else?

Also happy to get feedback/comments on the code already moved, not just on the open questions above.

fixes #14253

@rustbot rustbot added the needs-fcp PRs that add, remove, or rename lints and need an FCP label Aug 6, 2026
@MassimilianoBaglioni
MassimilianoBaglioni marked this pull request as ready for review August 6, 2026 13:30
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties S-waiting-on-community-reviews Status: This is awaiting for positive reviews from the community before a maintainer is assigned. labels Aug 6, 2026
@Jarcho

Jarcho commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Can you split this into one commit per lint moved, please. Also when fixing CI errors you're better off force-pushing. We're going to ask you to squash those commits before merging and it doesn't affect reviewers much if you're immediately changing commits.

@MassimilianoBaglioni
MassimilianoBaglioni force-pushed the strings-to-method-refactor branch from 04a75b8 to 27e5b3f Compare August 11, 2026 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-fcp PRs that add, remove, or rename lints and need an FCP 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.

Refactor the clippy_lints/src/strings.rs file

3 participants