A header defines a function that is neither static nor inline, so every file that includes it defines the function again

tx0/c:header-defines-functionstrictwarningreliability/api-misusedepth fastbug

What it finds

int clamp(int x) { ... } in a .h file: each source file that includes the header gets its own external definition, and linking two of them fails with a duplicate symbol, or, with common symbols allowed, picks one silently. The definition belongs in a source file, or the function should be static inline.

From the rule's source, header_defines_function.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:header-defines-function" = "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:header-defines-function] reason="..."

tx0 explain tx0/c:header-defines-function shows the same in the terminal. Found a false positive? Report it.