Refactoring; do not use pointless lambda
This commit is contained in:
parent
5acd6fcdc8
commit
efa113db55
|
@ -1409,17 +1409,14 @@ void CheckOther::checkConstVariable()
|
||||||
}
|
}
|
||||||
// Skip if we ever cast this variable to a pointer/reference to a non-const type
|
// Skip if we ever cast this variable to a pointer/reference to a non-const type
|
||||||
{
|
{
|
||||||
bool castToNonConst = [&] {
|
bool castToNonConst = false;
|
||||||
for (const Token* tok = var->nameToken(); tok != scope->bodyEnd && tok != nullptr; tok = tok->next())
|
for (const Token* tok = var->nameToken(); tok != scope->bodyEnd && tok != nullptr; tok = tok->next()) {
|
||||||
{
|
if (tok->isCast()) {
|
||||||
if (tok->isCast()) {
|
bool isConst = 0 != (tok->valueType()->constness & (1 << tok->valueType()->pointer));
|
||||||
bool isConst = 0 != (tok->valueType()->constness & (1 << tok->valueType()->pointer));
|
if (!isConst)
|
||||||
if (!isConst)
|
castToNonConst = true;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
}
|
||||||
}();
|
|
||||||
if (castToNonConst)
|
if (castToNonConst)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue