A function returns a class object by const value, which stops the caller from moving from it

tx0/cpp:const-value-returnstrictwarningperformance/algorithmicdepth fastperformance

What it finds

const std::string name(); returns a const object, so auto s = name(); and assignments from it copy instead of moving. Returning by plain value has the same safety for the caller and allows the move.

From the rule's source, const_value_return.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/cpp:const-value-return" = "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:const-value-return] reason="..."

tx0 explain tx0/cpp:const-value-return shows the same in the terminal. Found a false positive? Report it.