A static variable at file scope is never used in its file

tx0/c:unused-static-variablestrictwarningmaintainability/dead-codedepth fastsmell

What it finds

static int retries; at the top level of a source file, with no other mention of retries in the file: a variable with internal linkage that nothing reads or writes is dead, often left over from a refactoring.

Only source files count, not headers. The name must occur nowhere else in the code of the file, also not in macros or branches of conditional directives that are not read, and the declaration must not say it may be unused. Files whose macros paste names with ##, or that include other files than headers, may name the variable in ways the file does not show, and are left alone.

From the rule's source, unused_static_variable.rs.

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:unused-static-variable" = "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:unused-static-variable] reason="..."

tx0 explain tx0/c:unused-static-variable shows the same in the terminal. Found a false positive? Report it.