Repository navigation
Conversation
|
Thanks for the pull request. A reviewer will take a look after it receives 2 community reviews. In the meantime, we would highly appreciate if you could try to review any of PRs waiting on community reviews. |
|
Lintcheck changes for dd9dd13
This comment will be updated if you push new changes |
|
Cool, found one in cargo of all things. |
|
Thanks @CommanderStorm for the review. I incorporated all suggestions and also extended the lint to also cover arrays and slices instead of just |
I think you forgot to push, right? 😅 |
4c81456 to
80edf9a
Compare
|
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
80edf9a to
6543d13
Compare
redundant_clone to cover vec.contains(&str.to_string())unnecessary_to_owned to cover vec.contains(&str.to_string())
|
r? @dswij rustbot has assigned @dswij for the project review. Use Why was this reviewer chosen?The reviewer was selected based on:
|
6543d13 to
5d3451c
Compare
|
I think there's still a problem if the collection type is inferred from the |
5d3451c to
dd9dd13
Compare
|
Ok, this should now be fixed. @dswij r? |
I happened upon this pattern in a codebase I was working on, and was surprised it wasn't covered already. Using any
Vec::<String>::containsorVecDeque::<String>::containswill require the argument to be of type&String, so people sometimes use&_.to_string()for the value, despite the fact that_.iter().any(|x| x == _)does the same linear scan and requires no additional allocation. A small thing, but we can still lint it.changelog: extend
redundant_cloneto covervec.contains(&str.to_string())