Functions
F.48
Don't `return std::move(local)`
Reason
Returning a local variable implicitly moves it anyway. An explicit std::move is always a pessimization, because it prevents Return Value Optimization (RVO), which can eliminate the move completely.
Example, bad
S bad()
{
S result;
return std::move(result);
}
Example, good
S good()
{
S result;
// Named RVO: move elision at best, move construction at worst
return result;
}
Enforcement
This should be enforced by tooling by checking the return expression.