New Lint: push same item to Vec (#4078)#4647
New Lint: push same item to Vec (#4078)#4647EthanTheMaster wants to merge 10 commits intorust-lang:masterfrom
Conversation
|
☔ The latest upstream changes (presumably #4560) made this pull request unmergeable. Please resolve the merge conflicts. |
de7681b to
e9f12f0
Compare
|
☔ The latest upstream changes (presumably #4683) made this pull request unmergeable. Please resolve the merge conflicts. |
|
@EthanTheMaster you have merge conflict markers in your latest commit (in README.md) |
|
☔ The latest upstream changes (presumably #4650) made this pull request unmergeable. Please resolve the merge conflicts. |
|
☔ The latest upstream changes (presumably #4788) made this pull request unmergeable. Please resolve the merge conflicts. |
|
☔ The latest upstream changes (presumably #4839) made this pull request unmergeable. Please resolve the merge conflicts. |
|
Thanks for contributing to Clippy! Sadly this PR was not updated in quite some time. If you waited on input from a reviewer, we're sorry that this fell under the radar. If you want to continue to work on this, just reopen the PR and/or ping a reviewer. |
Add the new lint `same_item_push` changelog: Add the new lint `same_item_push` Fixed #4078. As I said in #4078 (comment), I referrerd to #4647.
Add the new lint `same_item_push` changelog: Add the new lint `same_item_push` Fixed #4078. As I said in #4078 (comment), I referrerd to #4647.
Add the new lint `same_item_push` changelog: Add the new lint `same_item_push` Fixed #4078. As I said in #4078 (comment), I referrerd to #4647.
Add the new lint `same_item_push` changelog: Add the new lint `same_item_push` Fixed rust-lang#4078. As I said in rust-lang#4078 (comment), I referrerd to rust-lang#4647.
|
@rustbot label -S-inactive-closed |
This PR has an implementation for the lint suggested in issue #4078. Pushing the same item into a
Veccan be done withvec![item; SIZE]or withVec::resize(). I did try to reduce false positives by not giving lints forforloops with conditional branching, loops, or multiple pushes.I noticed how problematic these things can be when I saw inside
src/ptr.rswhere the branching makes the loop terminate early. As a result, these kinds of loops are not considered for linting.Similarly,
src/booleans.rshas multiple pushes which may occur in an iteration depending on some condition.changelog: New lint:
push_same_item