A lambda captures a variable by name that its body never uses

tx0/cpp:unused-lambda-capturerecommendedwarningmaintainability/dead-codedepth fastsmell

What it finds

A capture the body does not use copies the variable or keeps a reference to it for nothing, and suggests a dependency that does not exist. Captures with an initializer, which may hold an object for its lifetime, are left alone.

From the rule's source, unused_lambda_capture.rs.

Turn it on, off or suppress it

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

tx0.toml
[rules]
"tx0/cpp:unused-lambda-capture" = "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/cpp:unused-lambda-capture] reason="..."

tx0 explain tx0/cpp:unused-lambda-capture shows the same in the terminal. Found a false positive? Report it.