-
Notifications
You must be signed in to change notification settings - Fork 1.7k
match_on_vec_items: false positive on match vec[..]
#5551
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
Labels
C-bug
Category: Clippy is not doing the correct thing
C-enhancement
Category: Enhancement of lints, like adding more cases or adding help messages
good first issue
These issues are a good way to get started with Clippy
Comments
cc @CrazyRoka This lint shouldn't trigger on wild @goffrie Why do you think this lint isn't useful? |
When I updated clippy a number of callsites lit up with the lint where it
was impossible for the indexing to panic (usually because the length was
just checked in some way). Using `get` would have made the the code less
clear.
Though I feel that this is more of a "teaching" lint for people writing new
code.
…On Fri., May 1, 2020, 05:24 Philipp Krones, ***@***.***> wrote:
cc @CrazyRoka <https://github.com/CrazyRoka> This lint shouldn't trigger
on wild [..] patterns.
@goffrie <https://github.com/goffrie> Why do you think this lint is not
useful? x.get(/*...*/) can never panic, while x[/*...*/] can. IMO using
get is a clear improvement.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#5551 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJO2TXUKOP6UEDS6XO6MR3RPK5OXANCNFSM4MW2ODTQ>
.
|
Alright, that is a fair point. I'll move the lint to pedantic (allow-by-default) |
bors
added a commit
that referenced
this issue
May 2, 2020
Move match_on_vec_items to pedantic Addresses #5551 (comment) Fixes #5553 changelog: Move [`match_on_vec_items`] to pedantic r? @phansch
bors
added a commit
that referenced
this issue
May 2, 2020
Move match_on_vec_items to pedantic Addresses #5551 (comment) Fixes #5553 changelog: Move [`match_on_vec_items`] to pedantic r? @phansch
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
C-bug
Category: Clippy is not doing the correct thing
C-enhancement
Category: Enhancement of lints, like adding more cases or adding help messages
good first issue
These issues are a good way to get started with Clippy
Sample program:
Clippy output:
However, this use of indexing is infallible.
(note that I'm silencing this lint globally anyway because I don't consider it useful)
The text was updated successfully, but these errors were encountered: