Skip to content

Check for known array length in needless_range_loop #3339

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

Merged
merged 2 commits into from
Oct 24, 2018

Conversation

HMPerson1
Copy link
Contributor

In VarVisitor, we now keep track of the type of the thing that was directly indexed and, if it's an array, check if the range's end is (or is past) the array's length.

Fixes #3033

@phansch
Copy link
Member

phansch commented Oct 24, 2018

LGTM, thanks!

bors r+

bors bot added a commit that referenced this pull request Oct 24, 2018
3339: Check for known array length in `needless_range_loop` r=phansch a=HMPerson1

In `VarVisitor`, we now keep track of the type of the thing that was directly indexed and, if it's an array, check if the range's end is (or is past) the array's length.

Fixes  #3033

Co-authored-by: HMPerson1 <[email protected]>
@phansch
Copy link
Member

phansch commented Oct 24, 2018

bors r+ (retrying.. couldn't find the staging.tmp branch?)

@bors
Copy link
Contributor

bors bot commented Oct 24, 2018

Not awaiting review

@phansch
Copy link
Member

phansch commented Oct 24, 2018

bors retry

@bors
Copy link
Contributor

bors bot commented Oct 24, 2018

Not awaiting review

@bors
Copy link
Contributor

bors bot commented Oct 24, 2018

@bors bors bot merged commit 553d01d into rust-lang:master Oct 24, 2018
@HMPerson1 HMPerson1 deleted the array_range_loop branch October 25, 2018 02:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants