A parameter is assigned a new value in the body of its function

tx0/c:parameter-reassignedallwarningstyle/conventionsdepth faststyle

What it finds

len = len - 1; with len a parameter: after the assignment the name no longer holds what the caller passed, and code further down that reads it to mean the argument reads something else. A local variable with a name of its own keeps both.

Assignments, increments and decrements of a parameter in the body of its function count, each parameter once, at its first change.

From the rule's source, parameter_reassigned.rs.

Example from the rule's tests
int count_down(int len, int step){  int total = 0;  while (len > 0) {    len -= step;tx0 reports: the parameter len is given a new value    total++;    len--;  }  return total;}
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 all tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/c:parameter-reassigned" = "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:parameter-reassigned] reason="..."

tx0 explain tx0/c:parameter-reassigned shows the same in the terminal. Found a false positive? Report it.