Skip to content

Do not make incomplete or invalid suggestions #14487

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

Conversation

samueltardieu
Copy link
Contributor

The unnecessary_filter_map and unnecessary_find_map lints were making partial suggestions, proposing to replace the whole expression by only the method name, or a subexpression which contained explicit placeholders.

Since even MaybeIncorrect suggestions must generate code that compiles, this changes those lints to recommandation lints with no code suggestion.

Fixes #14486

changelog: [unnecessary_find_map, unnecessary_filter_map]: do not make suggestions that will not compile

@rustbot
Copy link
Collaborator

rustbot commented Mar 27, 2025

r? @Manishearth

rustbot has assigned @Manishearth.
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

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Mar 27, 2025
Copy link
Member

@Manishearth Manishearth left a comment

Choose a reason for hiding this comment

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

We do have HasPlaceholders, but I agree, that's not a useful suggestion here

@Manishearth Manishearth enabled auto-merge March 27, 2025 21:07
The `unnecessary_filter_map` and `unnecessary_find_map` lints were
making partial suggestions, proposing to replace the whole expression by
only the method name, or a subexpression which contained explicit
placeholders.

Since even `MaybeIncorrect` suggestions must generate code that
compiles, this changes those lints to recommandation lints with no
code suggestion.
@samueltardieu samueltardieu force-pushed the push-564596399bbc6301d1df5e88159aae64 branch from 12694c8 to 01820a9 Compare March 27, 2025 21:11
@Manishearth Manishearth added this pull request to the merge queue Mar 27, 2025
Merged via the queue into rust-lang:master with commit 61b38e7 Mar 27, 2025
11 checks passed
@samueltardieu samueltardieu deleted the push-564596399bbc6301d1df5e88159aae64 branch March 31, 2025 16:45
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.

unnecessary_find_map should have Applicability::HasPlaceholders?
3 participants