Skip to content

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

Merged
iphydf merged 1 commit into
TokTok:masterfrom
iphydf:early-return
Jul 21, 2018
Merged

Reduce nesting by doing more early returns on error.#1018
iphydf merged 1 commit into
TokTok:masterfrom
iphydf:early-return

Conversation

@iphydf

@iphydf iphydf commented Jul 19, 2018

Copy link
Copy Markdown
Member

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

@iphydf iphydf added this to the v0.2.x milestone Jul 19, 2018

@sudden6 sudden6 left a comment

Copy link
Copy Markdown

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)

@sudden6 sudden6 left a comment

Copy link
Copy Markdown

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants