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

Deprecate match_on_vec_items lint #14217

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

samueltardieu
Copy link
Contributor

@samueltardieu samueltardieu commented Feb 14, 2025

This lint does more harm than good: in its description, it proposes to rewrite match on Vec<_> indexes or slices by a version which cannot panic but masks the failure by choosing the default variant.

The clippy::indexing_slicing restriction lint covers those cases more safely, by suggesting to use a non-panicking version to retrieve the value from the container, without suggesting to fallback to the default success variant in case of failure.

This PR is an (opposite) alternative to #14208 (which will add a suggestion to the lint matching the lint description). Discussion on both PRs can be found on Zulip.

changelog: [match_on_vec_items]: deprecate lint

@rustbot
Copy link
Collaborator

rustbot commented Feb 14, 2025

r? @llogiq

rustbot has assigned @llogiq.
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 Feb 14, 2025
This lint does more harm than good: in its description, it proposes to
rewrite `match` on `Vec<_>` indexes or slices by a version which cannot
panic but masks the failure by choosing the default variant.

The `clippy::indexing_slicing` restriction lint covers those cases more
safely, by suggesting to use a non-panicking version to retrieve the
value from the container, without suggesting to fallback to the default
success variant in case of failure.
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.

3 participants