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

New never loop lint #1549

Merged
merged 2 commits into from
Feb 17, 2017
Merged

New never loop lint #1549

merged 2 commits into from
Feb 17, 2017

Conversation

llogiq
Copy link
Contributor

@llogiq llogiq commented Feb 17, 2017

This lint detects loops that unconditionally break or return.

Closes #257

This lint detects loops that unconditionally break or return.

Closes #257
Copy link
Member

@Manishearth Manishearth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, one issue.

ExprTupField(ref e, _) |
ExprRepeat(ref e, _) |
ExprAddrOf(_, ref e) => never_loop_expr(e),
ExprBinary(_, ref e1, ref e2) |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Binary ops are short circuiting, so this can only be done on the first operand.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

@oli-obk oli-obk merged commit 96c9303 into master Feb 17, 2017
@oli-obk oli-obk deleted the never_loop branch February 17, 2017 12:40
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.

3 participants