Skip to content

Commit 9c6ed23

Browse files
committed
useStlAlgorithm
1 parent d905750 commit 9c6ed23

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

lib/checkunusedvar.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1630,12 +1630,12 @@ void CheckUnusedVar::checkStructMemberUsage()
16301630
}
16311631
// Member referenced in alignas
16321632
if (tok->hasAttributeAlignas()) {
1633-
for (const std::string& alignasExpr : tok->getAttributeAlignas()) {
1634-
if (alignasExpr == var.name()) {
1635-
use = true;
1636-
break;
1637-
}
1638-
}
1633+
const std::vector<std::string> alignasExpressions = tok->getAttributeAlignas();
1634+
use = std::any_of(alignasExpressions.cbegin(),
1635+
alignasExpressions.cend(),
1636+
[&var](const std::string& alignasExpr){ return alignasExpr == var.name(); });
1637+
if (use)
1638+
break;
16391639
}
16401640
if (tok->variable() != &var)
16411641
continue;

0 commit comments

Comments
 (0)