The condition of an if is a constant, so one branch never runs

tx0/c:constant-if-conditionstrictwarningsmell

What it finds

if (0) { ... } or if (1): one branch is dead code kept in a form the compiler still checks; a comment or removing the code says the same more plainly.

From the rule's source, constant_if_condition.rs.

Example from the rule's tests
int run(int n){  if (0)tx0 reports: the condition is a constant    n++;  if (n)    n--;  return n;}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/c:constant-if-condition" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/c:constant-if-condition] reason="..."

tx0 explain tx0/c:constant-if-condition shows the same in the terminal. Found a false positive? Report it.