The pointer that release() of a std::unique_ptr returns is dropped, and the object is never deleted
What it finds
p.release() gives up ownership and returns the raw pointer; dropping it leaks the object. p.reset() deletes the object instead.
From the rule's source, unique_ptr_release_discarded.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:
[rules]
"tx0/cpp:unique-ptr-release-discarded" = "error"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:unique-ptr-release-discarded] reason="..."tx0 explain tx0/cpp:unique-ptr-release-discarded shows the same in the terminal. Found a false positive? Report it.