Open
Description
Suppose you introduce a variable in the scope of the if
statement like so:
size_t index{};
if( const auto pos{ std::find( geom->materialIds.begin(), geom->materialIds.end(), proxyMaterialId ) };
pos == geom->materialIds.end() )
{
throw std::runtime_error( "Mismatched material id; expected one of " + toString( geom->materialIds ) + ", got "
+ std::to_string( proxyMaterialId ) );
}
else
{
index = std::distance( geom->materialIds.begin(), pos );
}
readability-else-after-return
doesn't recognize the use of the scoped variable in the else and flags the else after return as a violation. This is a false positive.