A std::unique_ptr or std::shared_ptr is initialized with new, where std::make_unique or std::make_shared says it once

tx0/cpp:smart-pointer-from-newallnotestyle/conventionsdepth faststyle

What it finds

std::make_unique<T>(args) names the type once, cannot leak between the allocation and the construction of the owner, and for std::shared_ptr allocates the object and its count together. Arrays and owners with a custom deleter are left alone.

From the rule's source, smart_pointer_from_new.rs.

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/cpp:smart-pointer-from-new" = "note"

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:smart-pointer-from-new] reason="..."

tx0 explain tx0/cpp:smart-pointer-from-new shows the same in the terminal. Found a false positive? Report it.