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

Reduce nesting by doing more early returns on error. #1018

Merged
merged 1 commit into from
Jul 21, 2018

Conversation

iphydf
Copy link
Member

@iphydf iphydf commented Jul 19, 2018

This almost entirely avoids any else-after-return in toxcore. One case is
left, and that one is more readable this way.

Why no else-after-return: https://llvm.org/docs/CodingStandards.html#don-t-use-else-after-a-return
Why exemptions exist: https://blog.mozilla.org/nnethercote/2009/08/31/no-else-after-return-considered-harmful/


This change is Reviewable

Copy link

@sudden6 sudden6 left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 2 files at r1.
Reviewable status: 0 of 1 LGTMs obtained (waiting on @sudden6)

Copy link

@sudden6 sudden6 left a comment

Choose a reason for hiding this comment

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

:lgtm_strong: and I like this policy

Reviewable status: :shipit: complete! 1 of 1 LGTMs obtained

This almost entirely avoids any else-after-return in toxcore. One case is
left, and that one is more readable this way.

Why no else after return: https://llvm.org/docs/CodingStandards.html#don-t-use-else-after-a-return
Why exemptions exist: https://blog.mozilla.org/nnethercote/2009/08/31/no-else-after-return-considered-harmful/
@iphydf iphydf merged commit 9a96bb9 into TokTok:master Jul 21, 2018
@iphydf iphydf deleted the early-return branch July 21, 2018 14:44
@iphydf iphydf modified the milestones: v0.2.x, v0.2.5 Aug 4, 2018
This pull request was closed.
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