Re: [PATCH 07/11] Avoid redundant conditions
- From
Jeff King <peff@peff.net>
- Date
- May 15, 2025, 20:13 UTC
- Message-ID
- <20250515201307.GH3320240@coredump.intra.peff.net>
- In-Reply-To
- <7d92e08b0c06a546ffd937c333b97d2fb6cd9817.1747314709.git.gitgitgadget@gmail.com>
On Thu, May 15, 2025 at 01:11:45PM +0000, Johannes Schindelin via GitGitGadget wrote:
Show 8 quoted lines
> From: Johannes Schindelin <johannes.schindelin@gmx.de> > > While `if (i <= 0) ... else if (i > 0) ...` is technically equivalent to > `if (i <= 0) ... else ...`, the latter is vastly easier to read because > it avoids writing out a condition that is unnecessary. Let's drop such > unnecessary conditions. > > Pointed out by CodeQL.
Yeah, I'd agree that it is easier (otherwise, you are left wondering if there is an "else" case you are missing).
> help.c | 2 +- > transport-helper.c | 2 +-
Both spots look good to me.
-Peff