emplace_back or emplace is given a pair or tuple built in place, which constructs a temporary and moves it
What it finds
v.emplace_back(std::make_pair(a, b)) builds the pair first and then moves it into the container, as push_back would. Passing the constructor arguments, v.emplace_back(a, b), builds the element where it lives.
From the rule's source, emplace_of_temporary.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:
[rules]
"tx0/cpp:emplace-of-temporary" = "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:emplace-of-temporary] reason="..."tx0 explain tx0/cpp:emplace-of-temporary shows the same in the terminal. Found a false positive? Report it.