Remove redundant type check (#3689)

This commit is contained in:
chrchr-github 2022-01-12 22:25:37 +01:00 committed by GitHub
parent bd2c4bb0a6
commit 59837be152
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 2 deletions

View File

@ -710,8 +710,7 @@ void CheckUnusedVar::checkFunctionVariableUsage_iterateScopes(const Scope* const
i->typeEndToken()->isStandardType() ||
isRecordTypeWithoutSideEffects(i->type()) ||
mSettings->library.detectContainer(i->typeStartToken(), /*iterator*/ false) ||
(i->isStlType() &&
!Token::Match(i->typeStartToken()->tokAt(2), "lock_guard|unique_lock|shared_ptr|unique_ptr|auto_ptr|shared_lock")))
i->isStlType())
type = Variables::standard;
if (type == Variables::none || isPartOfClassStructUnion(i->typeStartToken()))
continue;